日期:2014-05-17 浏览次数:20826 次
class ListNode<T>
{
private T data;
public T Data
{
get { return data; }
set { data = value; }
}
private ListNode<T> next;
internal ListNode<T> Next
{
get { return next; }
set { next = value; }
}
public ListNode(T val)
{
data = val;
next = null;
}
public ListNode(ListNode<T> p)
{
next = p;
}
public ListNode()
{
data = default(T);
next = null;
}
}
public void Append(T data)
{
ListNode<T> newNode = new ListNode<T>(data);
ListNode<T> currNode = null;
if (head == null)
{
head = newNode;
return;
}
//?currNode保存的到底是head的引用还是一个新的节点
currNode = head;
while (currNode.Next != null)
{
currNode = currNode.Next;
&n