Visual Basic (Declaration) | |
---|---|
Public Function New() |
C# | |
---|---|
public LListNode.LList<T>() |
Library/Library.Test/TestLinkList.cs
C# | Copy Code |
---|---|
LListNode<string> empty = new LListNode<string>(); LListNode<string> valueA = new LListNode<string>("A"); LListNode<string> valueB = new LListNode<string>("B"); LListNode<string>.LList list = new LListNode<string>.LList(); list.AddFirst(empty); Assert.AreEqual(1, list.Count); Assert.AreEqual(empty, list.First); Assert.AreEqual(empty, list.Last); Assert.IsNull(empty.Next); Assert.IsNull(empty.Previous); list.AddLast(valueB); Assert.AreEqual(2, list.Count); Assert.AreEqual(empty, list.First); Assert.AreEqual(valueB, list.Last); Assert.AreEqual(valueB, empty.Next); Assert.IsNull(empty.Previous); Assert.AreEqual(empty, valueB.Previous); Assert.IsNull(valueB.Next); list.AddFirst(valueA); Assert.AreEqual(3, list.Count); Assert.AreEqual(valueA, list.First); Assert.AreEqual(valueB, list.Last); Assert.AreEqual(valueB, empty.Next); Assert.AreEqual(valueA, empty.Previous); Assert.AreEqual(empty, valueA.Next); Assert.IsNull(valueA.Previous); Assert.AreEqual(empty, valueB.Previous); Assert.IsNull(valueB.Next); list.Remove(empty); Assert.AreEqual(2, list.Count); Assert.AreEqual(valueA, list.First); Assert.AreEqual(valueB, list.Last); Assert.AreEqual(valueB, valueA.Next); Assert.IsNull(valueA.Previous); Assert.AreEqual(valueA, valueB.Previous); Assert.IsNull(valueB.Next); |
VB.NET | Copy Code |
---|---|
Dim empty As New LListNode(Of String)() Dim valueA As New LListNode(Of String)("A") Dim valueB As New LListNode(Of String)("B") Dim list As New LListNode(Of String).LList() list.AddFirst(empty) Assert.AreEqual(1, list.Count) Assert.AreEqual(empty, list.First) Assert.AreEqual(empty, list.Last) Assert.IsNull(empty.[Next]) Assert.IsNull(empty.Previous) list.AddLast(valueB) Assert.AreEqual(2, list.Count) Assert.AreEqual(empty, list.First) Assert.AreEqual(valueB, list.Last) Assert.AreEqual(valueB, empty.[Next]) Assert.IsNull(empty.Previous) Assert.AreEqual(empty, valueB.Previous) Assert.IsNull(valueB.[Next]) list.AddFirst(valueA) Assert.AreEqual(3, list.Count) Assert.AreEqual(valueA, list.First) Assert.AreEqual(valueB, list.Last) Assert.AreEqual(valueB, empty.[Next]) Assert.AreEqual(valueA, empty.Previous) Assert.AreEqual(empty, valueA.[Next]) Assert.IsNull(valueA.Previous) Assert.AreEqual(empty, valueB.Previous) Assert.IsNull(valueB.[Next]) list.Remove(empty) Assert.AreEqual(2, list.Count) Assert.AreEqual(valueA, list.First) Assert.AreEqual(valueB, list.Last) Assert.AreEqual(valueB, valueA.[Next]) Assert.IsNull(valueA.Previous) Assert.AreEqual(valueA, valueB.Previous) Assert.IsNull(valueB.[Next]) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
LListNode.LList<T> ClassLListNode.LList<T> Members