本文整理汇总了C#中System.Collections.SortedSet.ExceptWith方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.ExceptWith方法的具体用法?C# SortedSet.ExceptWith怎么用?C# SortedSet.ExceptWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.SortedSet
的用法示例。
在下文中一共展示了SortedSet.ExceptWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExceptWithItself
public void ExceptWithItself ()
{
var set = new SortedSet<int> (new [] { 1, 5 });
set.ExceptWith (set);
Assert.AreEqual (0, set.Count);
}
示例2: ExceptWith_Null
public void ExceptWith_Null ()
{
var set = new SortedSet<int> ();
set.ExceptWith (null);
}
示例3: ExceptWith
public void ExceptWith ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
set.ExceptWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 });
Assert.IsTrue (set.SequenceEqual (new [] { 1, 9 }));
}
示例4: CheckOutcomeCore
//.........这里部分代码省略.........
if (0 < timedOut.Count)
{
result = CheckSplit(timedOut, ref popLater, options.TimeLimit, timeLimitPerAssertion, ref queries);
if (result == Outcome.Valid)
{
timedOut.Clear();
}
else if (result == Outcome.TimeOut)
{
// Give up and report which assertions were not verified.
var cmds = timedOut.Select(id => ctx.TimeoutDiagnosticIDToAssertion[id]);
if (cmds.Any())
{
handler.OnResourceExceeded("timeout after running diagnostics", cmds);
}
}
}
else
{
result = Outcome.Valid;
}
break;
}
// TODO(wuestholz): Try out different ways for splitting up the work (e.g., randomly).
var cnt = Math.Max(1, rem / frac);
// It seems like assertions later in the control flow have smaller indexes.
var split = new SortedSet<int>(unverified.Where((val, idx) => (rem - idx - 1) < cnt));
Contract.Assert(0 < split.Count);
var splitRes = CheckSplit(split, ref popLater, timeLimitPerAssertion, timeLimitPerAssertion, ref queries);
if (splitRes == Outcome.Valid)
{
unverified.ExceptWith(split);
frac = 1;
}
else if (splitRes == Outcome.Invalid)
{
result = splitRes;
break;
}
else if (splitRes == Outcome.TimeOut)
{
if (2 <= frac && (4 <= (rem / frac)))
{
frac *= 4;
}
else if (2 <= (rem / frac))
{
frac *= 2;
}
else
{
timedOut.UnionWith(split);
unverified.ExceptWith(split);
frac = 1;
}
}
else
{
break;
}
}
unverified.UnionWith(timedOut);