当前位置: 首页>>代码示例>>C#>>正文


C# DoublyLinkedList.Remove方法代码示例

本文整理汇总了C#中DoublyLinkedList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# DoublyLinkedList.Remove方法的具体用法?C# DoublyLinkedList.Remove怎么用?C# DoublyLinkedList.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DoublyLinkedList的用法示例。


在下文中一共展示了DoublyLinkedList.Remove方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveForASingleItemList

 public void RemoveForASingleItemList()
 {
     DoublyLinkedList<int> list = new DoublyLinkedList<int>();
     list.AddAtTail(7);
     list.Remove(7);
     list.ShouldBeEmpty();
 }
开发者ID:paulcicio,项目名称:Training,代码行数:7,代码来源:DoublyLinkedListTests.cs

示例2: RemoveForEmptyList

 public void RemoveForEmptyList()
 {
     DoublyLinkedList<int> list = new DoublyLinkedList<int>();
     list.Remove(7);
 }
开发者ID:paulcicio,项目名称:Training,代码行数:5,代码来源:DoublyLinkedListTests.cs

示例3: RemoveTailPUT

 public void RemoveTailPUT([PexAssumeUnderTest]IList<int> values, int randomPick1)
 {
     PexAssume.AreDistinctValues<int>(values as int[]);
     PexAssume.IsTrue(values.Contains(randomPick1));
     DoublyLinkedList<int> dll = new DoublyLinkedList<int> (values);
     bool tail = dll.Tail.Value == randomPick1 ? true:false;
     bool head = dll.Head.Value == randomPick1 ? true : false;
     PexObserve.ValueForViewing<bool>("isTail", tail);
     PexObserve.ValueForViewing<bool>("isHead", head);
     dll.Remove(randomPick1);
     PexAssert.AreEqual(values.Count - 1, dll.Count);
     if (values.Count == 1)
     {
         PexAssert.IsTrue(dll.IsEmpty());
         //PexGoal.Reached("g1");
         return;
     }
     if (values.Count == 2)
     {
         PexAssert.AreEqual(dll.Head, dll.Tail);
         //PexGoal.Reached("g2");
     }
     if (tail)
     {
         PexAssert.AreEqual(values[values.Count - 2], dll.Tail.Value);
         //PexGoal.Reached("g3");
     }
     if (head)
     {
         PexAssert.AreEqual(values[1], dll.Head.Value);
        // PexGoal.Reached("g4");
     }
     PexAssert.IsFalse(dll.Contains(randomPick1));
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:34,代码来源:DoublyLinkedListTest.cs

示例4: RemoveForAListWithTwoItems

 public void RemoveForAListWithTwoItems()
 {
     DoublyLinkedList<int> list = new DoublyLinkedList<int>();
     int[] array = new int[5];
     list.Add(7);
     list.Add(6);
     list.Add(5);
     list.Add(4);
     list.Add(3);
     list.CopyTo(array, 0);
     list.Remove(5);
     list.CopyTo(array, 0);
     list.ShouldNotContain(5);
     list.ShouldContain(3);
 }
开发者ID:paulcicio,项目名称:Training,代码行数:15,代码来源:DoublyLinkedListTests.cs

示例5: RemoveTailTwoNodes

        public void RemoveTailTwoNodes()
        {
            DoublyLinkedList<string> dll = new DoublyLinkedList<string> {"London", "Paris"};

            dll.Remove("Paris");

            Assert.AreEqual("London", dll.Head.Value);
            Assert.AreEqual("London", dll.Tail.Value);
            Assert.AreEqual(1, dll.Count);
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:10,代码来源:DoublyLinkedListTest.cs

示例6: RemovePUT

 public void RemovePUT([PexAssumeUnderTest]IList<int> values, int randomPick)
 {
     DoublyLinkedList<int> dll = new DoublyLinkedList<int> (values);
     if (!values.Contains(randomPick))
         PexAssert.IsFalse(dll.Remove(randomPick));
     else
         PexAssert.IsTrue(dll.Remove(randomPick));
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:8,代码来源:DoublyLinkedListTest.cs

示例7: RemoveSingleNodeTest

        public void RemoveSingleNodeTest()
        {
            DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10};

            dll.Remove(10);

            Assert.IsTrue(dll.IsEmpty());
            Assert.IsNull(dll.Head);
            Assert.IsNull(dll.Tail);
            Assert.AreEqual(0, dll.Count);
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:11,代码来源:DoublyLinkedListTest.cs

示例8: RemoveTailMultipleNodesTest

        public void RemoveTailMultipleNodesTest()
        {
            DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};

            dll.Remove(30);

            Assert.AreEqual(20, dll.Tail.Value);
            Assert.IsNull(dll.Tail.Next);
            Assert.AreEqual(2, dll.Count);
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:10,代码来源:DoublyLinkedListTest.cs

示例9: RemoveNoMatchTest

        public void RemoveNoMatchTest()
        {
            DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10};

            Assert.IsFalse(dll.Remove(20));
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:6,代码来源:DoublyLinkedListTest.cs

示例10: RemoveMiddleMultipleNodesTest

        public void RemoveMiddleMultipleNodesTest()
        {
            DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};

            dll.Remove(20);

            Assert.AreEqual(30, dll.Head.Next.Value);
            Assert.AreEqual(10, dll.Tail.Previous.Value);
            Assert.AreEqual(2, dll.Count);
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:10,代码来源:DoublyLinkedListTest.cs

示例11: RemoveHeadMultipleNodesTest

        public void RemoveHeadMultipleNodesTest()
        {
            DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};

            dll.Remove(10);

            Assert.AreEqual(20, dll.Head.Value);
            Assert.IsNull(dll.Head.Previous);
            Assert.AreEqual(2, dll.Count);
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:10,代码来源:DoublyLinkedListTest.cs

示例12: RemoveEmptyListTest

        public void RemoveEmptyListTest()
        {
            DoublyLinkedList<int> dll = new DoublyLinkedList<int>();

            Assert.IsFalse(dll.Remove(10));
        }
开发者ID:robertrancz,项目名称:dsa,代码行数:6,代码来源:DoublyLinkedListTest.cs

示例13: TestDoublyLinkedListRemove

        public void TestDoublyLinkedListRemove()
        {
            DoublyLinkedList<string> list = new DoublyLinkedList<string>();
            list.Add("One");
            list.Add("Two");
            list.Add("Three");
            list[0] = "Zero";
            list.Remove("Three");

            string[] array = new string[list.Count];
            list.CopyTo(array);
            Assert.AreEqual("Zero, Two", string.Join(", ", array));
        }
开发者ID:Ivan-Dimitrov-bg,项目名称:.Net-framework,代码行数:13,代码来源:DoublyLinkedListTest.cs


注:本文中的DoublyLinkedList.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。