本文整理汇总了C#中SortedSet.SequenceEqual方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.SequenceEqual方法的具体用法?C# SortedSet.SequenceEqual怎么用?C# SortedSet.SequenceEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedSet
的用法示例。
在下文中一共展示了SortedSet.SequenceEqual方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSortedSet
public void TestSortedSet()
{
var set = new SortedSet<int>();
for (int i = 0; i < 10; i++) set.Add(i);
Assert.IsTrue(set.SequenceEqual(new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }));
}
示例2: FindFirstSynonym
public static String FindFirstSynonym(this IEnumerable<Node> tree, String path)
{
Contract.Requires(tree != null, String.Format(_mask, "tree"));
Contract.Requires(path != null, String.Format(_mask, "path"));
Contract.Requires(path.Contains("|"), "Doesn't support combinatorials yet");
var result = "Synonym not found";
var other = path.BuildTree();
var depth = other.Max(n => n.Item1);
var node = other.First(n => n.Item1 == depth);
var children = tree.Where(n => n.Item2 == node.Item3);
var potentialSynonyms = tree.Where(n => n.Item3 == children.First().Item3);
var maybeSynonyms = potentialSynonyms.Where(n => n.Item2 != node.Item3)
.Select(n => n);
var childrenSet = new SortedSet<String>(children.Select(n => n.Item3));
foreach (var item in maybeSynonyms)
{
var otherChildren = tree.Where(n => n.Item2 == item.Item2)
.Select(o => o.Item3);
var otherChildrenSet = new SortedSet<String>(otherChildren);
if (otherChildrenSet.SequenceEqual(childrenSet))
{
var miniTree = new SortedSet<Node>();
miniTree.Add(Tuple.Create(0, String.Empty, "home"));
miniTree.Add(Tuple.Create(item.Item1 - 1, "home", item.Item2));
result = miniTree.Collapse();
break;
}
}
return result;
}