當前位置: 首頁>>代碼示例>>C#>>正文


C# SinglyLinkedList.IndexOf方法代碼示例

本文整理匯總了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"));
 }
開發者ID:marsette25,項目名稱:csharplinkedlists,代碼行數:5,代碼來源:UnitTestSinglyLInkedList.cs

示例2: IndexOfNodeInMiddlePosition

 public void IndexOfNodeInMiddlePosition()
 {
     SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "grille");
     Assert.AreEqual(1, list.IndexOf("bar"));
 }
開發者ID:marsette25,項目名稱:csharplinkedlists,代碼行數:5,代碼來源:UnitTestSinglyLInkedList.cs

示例3: IndexOfOnEmptyList

 public void IndexOfOnEmptyList()
 {
     SinglyLinkedList list = new SinglyLinkedList();
     Assert.AreEqual(-1, list.IndexOf("bar"));
 }
開發者ID:marsette25,項目名稱:csharplinkedlists,代碼行數:5,代碼來源:UnitTestSinglyLInkedList.cs

示例4: IndexOfDuplicateNode

 public void IndexOfDuplicateNode()
 {
     SinglyLinkedList list = new SinglyLinkedList("foo", "bar", "bar", "grille");
     Assert.AreEqual(1, list.IndexOf("bar"));
 }
開發者ID:marsette25,項目名稱:csharplinkedlists,代碼行數:5,代碼來源:UnitTestSinglyLInkedList.cs

示例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"));
 }
開發者ID:tombler,項目名稱:LinkedListCohortJuniper,代碼行數:9,代碼來源:UnitTestSinglyLInkedList.cs

示例6: IndexOfNodeInLastPosition

 public void IndexOfNodeInLastPosition()
 {
     SinglyLinkedList<string> list = new SinglyLinkedList<string>("foo", "bar", "grille");
     Assert.AreEqual(2, list.IndexOf("grille"));
 }
開發者ID:sarah-story,項目名稱:LinkedList,代碼行數:5,代碼來源:UnitTestSinglyLInkedList.cs

示例7: testIndexOfNodeInFirst

 public void testIndexOfNodeInFirst()
 {
     SinglyLinkedList list = new SinglyLinkedList();
     list.AddFirst("node1");
     Assert.AreEqual(0, list.IndexOf("node1"));
 }
開發者ID:AustinScott3573,項目名稱:LinkedListCohortJuniper,代碼行數:6,代碼來源:UnitTestSinglyLInkedList.cs

示例8: testIndexOfNodeForMultipleItems

 public void testIndexOfNodeForMultipleItems()
 {
     SinglyLinkedList list = new SinglyLinkedList();
     list.AddFirst("node1");
     list.AddLast("node2");
     Assert.AreEqual(1, list.IndexOf("node2"));
 }
開發者ID:AustinScott3573,項目名稱:LinkedListCohortJuniper,代碼行數:7,代碼來源:UnitTestSinglyLInkedList.cs


注:本文中的SinglyLinkedLists.SinglyLinkedList.IndexOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。