当前位置: 首页>>代码示例>>C#>>正文


C# Set.Difference方法代码示例

本文整理汇总了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));
        }
开发者ID:rodriada000,项目名称:Mathos-Project,代码行数:8,代码来源:SetTest.cs

示例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());
        }
开发者ID:furesoft,项目名称:Mathos-Project,代码行数:8,代码来源:SetTest.cs

示例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.");
        }
开发者ID:tbashore,项目名称:TLib.NET,代码行数:12,代码来源:SetTests.cs

示例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);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:30,代码来源:FwProjPropertiesDlg.cs


注:本文中的Set.Difference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。