本文整理汇总了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"));
}