C#实现双向链表
/// <summary>
/// 双向链表节点类
/// </summary>
/// <typeparam name="T">节点中的存放的数据类型</typeparam>
public class Node<T>
{
/// <summary>
/// 当前节点的数据
/// </summary>
T data;
/// <summary>
/// 节点中存放的数据
/// </summary>
public T Data
{
get { return this.data; }
set { this.data = value; }
}
/// <summary>
/// 当前节点的下一个节点
/// </summary>
Node<T> next;
/// <summary>
/// 下一个节点
/// </summary>
public Node<T> Next
{
get { return this.next; }
set { this.next = value; }
}
/// <summary>
/// 当前节点的上一个节点
/// </summary>
Node<T> prev;
/// <summary>
/// 上一个节点
/// </summary>
public Node<T> Prev
{
get { return prev; }
set { prev = value; }
}
/// <summary>
/// 无参构造:数据为默认值,下一个节点为null,上一个节点也为null
/// </summary>
public Node()
{
this.data = default(T);
this.next = null;
this.prev = null;
}
/// <summary>
/// 构造方法:数据为传过来的t,下一个节点为null,上一个节点也为null
/// </summary>
/// <param name="t">传入的元素值</param>
public Node(T t)
{
this.data = t;
&n