forked from TheAlgorithms/C-Sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DoublyLinkedListNode.cs
35 lines (31 loc) · 1.04 KB
/
DoublyLinkedListNode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
namespace DataStructures.DoublyLinkedList
{
/// <summary>
/// Generic node class for Doubly Linked List.
/// </summary>
/// <typeparam name="T">Generic type.</typeparam>
public class DoublyLinkedListNode<T>
{
/// <summary>
/// Initializes a new instance of the <see cref="DoublyLinkedListNode{T}"/> class.
/// </summary>
/// <param name="data">Data to be stored in this node.</param>
public DoublyLinkedListNode(T data)
{
Data = data;
}
/// <summary>
/// Gets the data stored on this node.
/// </summary>
public T Data { get; }
/// <summary>
/// Gets or sets the reference to the next node in the Doubly Linked List.
/// </summary>
public DoublyLinkedListNode<T>? Next { get; set; }
/// <summary>
/// Gets or sets the reference to the previous node in the Doubly Linked List.
/// </summary>
public DoublyLinkedListNode<T>? Previous { get; set; }
}
}