本文整理匯總了C#中SinglyLinkedLists.SinglyLinkedList.Remove方法的典型用法代碼示例。如果您正苦於以下問題:C# SinglyLinkedList.Remove方法的具體用法?C# SinglyLinkedList.Remove怎麽用?C# SinglyLinkedList.Remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SinglyLinkedLists.SinglyLinkedList
的用法示例。
在下文中一共展示了SinglyLinkedList.Remove方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ListRemoveWithDuplicateNodes
public void ListRemoveWithDuplicateNodes()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille", "bar");
list.Remove("bar");
var expected = new string[] { "foo", "grille", "bar" };
CollectionAssert.AreEqual(expected, list.ToArray());
}
示例2: CountChangesOnRemoval
public void CountChangesOnRemoval()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
list.Remove("foo");
Assert.AreEqual(2, list.Count());
list.Remove("bar");
Assert.AreEqual(1, list.Count());
list.Remove("grille");
Assert.AreEqual(0, list.Count());
}
示例3: ListRemoveLastItemFromList
public void ListRemoveLastItemFromList()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
list.Remove("grille");
var expected = new string[] { "foo", "bar" };
CollectionAssert.AreEqual(expected, list.ToArray());
}
示例4: ListRemoveNonExistentNode
public void ListRemoveNonExistentNode()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
list.Remove("cat");
var expected = new string[] { "foo", "bar", "grille" };
CollectionAssert.AreEqual(expected, list.ToArray());
}
示例5: IndexOfRemovedElement
public void IndexOfRemovedElement()
{
SinglyLinkedList list = new SinglyLinkedList();
list.AddLast("foo");
list.AddLast("bar");
list.AddLast("grille");
list.Remove("foo");
Assert.AreEqual(-1, list.IndexOf("foo"));
}
示例6: ListRemoveItemFromMiddleOfList
public void ListRemoveItemFromMiddleOfList()
{
SinglyLinkedList<string> list = new SinglyLinkedList<string>("foo", "bar", "grille");
list.Remove("bar");
var expected = new string[] { "foo", "grille" };
CollectionAssert.AreEqual(expected, list.ToArray());
}
示例7: ListRemoveFirstNode
public void ListRemoveFirstNode()
{
SinglyLinkedList<string> list = new SinglyLinkedList<string>("foo", "bar", "grille");
list.Remove("foo");
var expected = new string[] { "bar", "grille" };
CollectionAssert.AreEqual(expected, list.ToArray());
}
示例8: ListRemoveFirstNode
public void ListRemoveFirstNode()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
list.Remove("foo");
var expected = new string[] { "bar", "grille" };
//throw new ArgumentException(list.ToString());
CollectionAssert.AreEqual(expected, list.ToArray());
}