本文整理汇总了C#中HashedSet.IsDisjointFrom方法的典型用法代码示例。如果您正苦于以下问题:C# HashedSet.IsDisjointFrom方法的具体用法?C# HashedSet.IsDisjointFrom怎么用?C# HashedSet.IsDisjointFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HashedSet
的用法示例。
在下文中一共展示了HashedSet.IsDisjointFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsDisjointFrom
public void IsDisjointFrom()
{
HashedSet<int> set1 = new HashedSet<int>(new int[] { 6, 7, 1, 11, 9, 3, 8 });
HashedSet<int> set2 = new HashedSet<int>();
HashedSet<int> set3 = new HashedSet<int>();
HashedSet<int> set4 = new HashedSet<int>(new int[] { 9, 1, 8, 3, 7, 6, 11 });
HashedSet<int> set5 = new HashedSet<int>(new int[] { 17, 3, 12, 10 });
HashedSet<int> set6 = new HashedSet<int>(new int[] { 19, 14, 0, 2 });
Assert.IsFalse(set1.IsDisjointFrom(set1));
Assert.IsTrue(set2.IsDisjointFrom(set2));
Assert.IsTrue(set1.IsDisjointFrom(set2));
Assert.IsTrue(set2.IsDisjointFrom(set1));
Assert.IsTrue(set2.IsDisjointFrom(set3));
Assert.IsTrue(set3.IsDisjointFrom(set2));
Assert.IsFalse(set1.IsDisjointFrom(set4));
Assert.IsFalse(set4.IsDisjointFrom(set1));
Assert.IsFalse(set1.IsDisjointFrom(set5));
Assert.IsFalse(set5.IsDisjointFrom(set1));
Assert.IsTrue(set1.IsDisjointFrom(set6));
Assert.IsTrue(set6.IsDisjointFrom(set1));
Assert.IsTrue(set5.IsDisjointFrom(set6));
Assert.IsTrue(set6.IsDisjointFrom(set5));
}