本文整理汇总了C#中Set.Difference方法的典型用法代码示例。如果您正苦于以下问题:C# Set.Difference方法的具体用法?C# Set.Difference怎么用?C# Set.Difference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Set
的用法示例。
在下文中一共展示了Set.Difference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DifferenceTest
public void DifferenceTest()
{
var a = new Set<int>(1, 2, 3);
var b = new Set<int>(2, 3, 4);
Console.WriteLine(a.Difference(b));
Console.WriteLine(b.Difference(a));
}
示例2: DifferenceTest
public void DifferenceTest()
{
var a = new Set<int>(1, 2, 3);
var b = new Set<int>(2, 3, 4);
Assert.AreEqual("{1}", a.Difference(b).ToString());
Assert.AreEqual("{4}", b.Difference(a).ToString());
}
示例3: Difference
public void Difference()
{
var s1 = new Set<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var s2 = new Set<int>() { 2, 4, 6, 8, 10 };
var s3 = s1.Difference(s2);
Console.Out.WriteLine(s3);
Assert.That(s3, Has.Count.EqualTo(s1.Count - s2.Count), "Incorrect number of elements.");
Assert.That(s3, Has.No.Member(10), "Element should have been eliminated.");
Assert.That(s3, Has.Member(9), "Missing element.");
}
示例4: PopulateWsContextMenu
static internal void PopulateWsContextMenu(ContextMenuStrip cmnuAddWs, Set<NamedWritingSystem> wssToAdd,
ListBox listToAddTo, EventHandler clickHandlerExistingWs, EventHandler clickHandlerNewWs,
EventHandler clickHandlerNewWsFromSelected, IWritingSystem selectedWs)
{
cmnuAddWs.Items.Clear();
cmnuAddWs.Tag = listToAddTo;
// Add the "Writing system for <language>..." menu item.
Set<NamedWritingSystem> relatedWss = new Set<NamedWritingSystem>();
if (clickHandlerNewWsFromSelected != null && selectedWs != null)
{
// Populate Context Menu with related wss.
relatedWss = WritingSystemPropertiesDialog.GetRelatedWss(wssToAdd, selectedWs);
AddExistingWssToContextMenu(cmnuAddWs, relatedWss, listToAddTo, clickHandlerExistingWs);
LanguageDefinition langDef = new LanguageDefinition(selectedWs);
ToolStripItem tsiNewWs = new ToolStripMenuItem(String.Format(FwCoreDlgs.ksWsNewFromExisting, langDef.LocaleName),
null, clickHandlerNewWsFromSelected);
cmnuAddWs.Items.Add(tsiNewWs);
}
// Add a separator and the "New..." menu item.
if (clickHandlerNewWs != null)
{
AddExistingWssToContextMenu(cmnuAddWs, wssToAdd.Difference(relatedWss), listToAddTo, clickHandlerExistingWs);
// Convert from Set to List, since the Set can't sort.
if (cmnuAddWs.Items.Count > 0)
cmnuAddWs.Items.Add(new ToolStripSeparator());
ToolStripItem tsiNewWs = new ToolStripMenuItem(FwCoreDlgs.ksWsNew, null, clickHandlerNewWs);
cmnuAddWs.Items.Add(tsiNewWs);
}
}