本文整理匯總了C#中SinglyLinkedLists.SinglyLinkedList.IndexOf方法的典型用法代碼示例。如果您正苦於以下問題:C# SinglyLinkedList.IndexOf方法的具體用法?C# SinglyLinkedList.IndexOf怎麽用?C# SinglyLinkedList.IndexOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SinglyLinkedLists.SinglyLinkedList
的用法示例。
在下文中一共展示了SinglyLinkedList.IndexOf方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: IndexOfStringThatDoesntExist
public void IndexOfStringThatDoesntExist()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
Assert.AreEqual(-1, list.IndexOf("cat"));
}
示例2: IndexOfNodeInMiddlePosition
public void IndexOfNodeInMiddlePosition()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
Assert.AreEqual(1, list.IndexOf("bar"));
}
示例3: IndexOfOnEmptyList
public void IndexOfOnEmptyList()
{
SinglyLinkedList list = new SinglyLinkedList();
Assert.AreEqual(-1, list.IndexOf("bar"));
}
示例4: IndexOfDuplicateNode
public void IndexOfDuplicateNode()
{
SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "bar", "grille");
Assert.AreEqual(1, list.IndexOf("bar"));
}
示例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: IndexOfNodeInLastPosition
public void IndexOfNodeInLastPosition()
{
SinglyLinkedList<string> list = new SinglyLinkedList<string>("foo", "bar", "grille");
Assert.AreEqual(2, list.IndexOf("grille"));
}
示例7: testIndexOfNodeInFirst
public void testIndexOfNodeInFirst()
{
SinglyLinkedList list = new SinglyLinkedList();
list.AddFirst("node1");
Assert.AreEqual(0, list.IndexOf("node1"));
}
示例8: testIndexOfNodeForMultipleItems
public void testIndexOfNodeForMultipleItems()
{
SinglyLinkedList list = new SinglyLinkedList();
list.AddFirst("node1");
list.AddLast("node2");
Assert.AreEqual(1, list.IndexOf("node2"));
}