本文整理汇总了C#中SinglyLinkedList.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# SinglyLinkedList.Contains方法的具体用法?C# SinglyLinkedList.Contains怎么用?C# SinglyLinkedList.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SinglyLinkedList
的用法示例。
在下文中一共展示了SinglyLinkedList.Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRemoveValue
public void TestRemoveValue()
{
var list = new SinglyLinkedList<string>();
list.AddLast("Expected");
list.AddLast("Expected");
list.AddLast("Not expected");
list.AddLast("Expected");
Assert.IsTrue(list.Remove("Not expected"));
Assert.IsFalse(list.Contains("Not expected"));
}
示例2: ContainsTest
public void ContainsTest()
{
SinglyLinkedList<int> sll = new SinglyLinkedList<int> {10, 20, 30};
Assert.IsTrue(sll.Contains(20));
Assert.IsFalse(sll.Contains(40));
}
示例3: Contains_should_return_false_when_doesnot_exist
public void Contains_should_return_false_when_doesnot_exist()
{
ISinglyLinkedList<int> list = new SinglyLinkedList<int>(new[] { 1, 2, 3 });
var result = list.Contains(4);
Assert.That(result, Is.False);
}
示例4: Contains_should_return_true_when_exist
public void Contains_should_return_true_when_exist()
{
ISinglyLinkedList<int> list = new SinglyLinkedList<int>(new[] { 1, 2, 3 });
var result = list.Contains(3);
Assert.That(result, Is.True);
}
示例5: ContainsTest
public void ContainsTest()
{
var list = new SinglyLinkedList<int> { 1, 0, -1 };
Assert.IsTrue(list.Contains(0), "The list does not contain the item");
}