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


C# System.Collections.Generic.Union方法代码示例

本文整理汇总了C#中System.Collections.Generic.Union方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.Union方法的具体用法?C# System.Collections.Generic.Union怎么用?C# System.Collections.Generic.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Generic的用法示例。


在下文中一共展示了System.Collections.Generic.Union方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetsFileIfItIsAnEmbeddedResource

        public void GetsFileIfItIsAnEmbeddedResource()
        {
            var table = Load("RollOrder.xml");

            var rolls = new[] { "1", "1", "1", "1d2", "1d3", "1d3+1", "1d4+2", "1d6+3", "1d6+5", "1d4+10" };
            Assert.That(table["All"], Is.EquivalentTo(rolls));

            var challengeRatings = new[] { "1/10", "1/8", "1/6", "1/4", "1/3", "1/2" };
            var levels = Enumerable.Range(1, 30).Select(l => l.ToString());
            Assert.That(table["CR"], Is.EquivalentTo(challengeRatings.Union(levels)));
        }
开发者ID:DnDGen,项目名称:EncounterGen,代码行数:11,代码来源:EmbeddedResourceStreamLoaderTests.cs

示例2: AssertEncounterGroupEntriesAreComplete

        protected void AssertEncounterGroupEntriesAreComplete()
        {
            var entries = new[]
               {
                string.Empty,
                EnvironmentConstants.Civilized,
                EnvironmentConstants.Desert,
                EnvironmentConstants.Dungeon,
                EnvironmentConstants.Forest,
                EnvironmentConstants.Hills,
                EnvironmentConstants.Marsh,
                EnvironmentConstants.Mountain,
                EnvironmentConstants.Plains,
                EnvironmentConstants.Temperatures.Cold,
                EnvironmentConstants.Temperatures.Temperate,
                EnvironmentConstants.Temperatures.Warm,
                EnvironmentConstants.TimesOfDay.Day,
                EnvironmentConstants.TimesOfDay.Night,
                GroupConstants.Magic,
                GroupConstants.Land,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Desert,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Dungeon,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Forest,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Hills,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Marsh,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Mountain,
                EnvironmentConstants.Temperatures.Cold + EnvironmentConstants.Plains,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Desert,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Dungeon,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Forest,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Hills,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Marsh,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Mountain,
                EnvironmentConstants.Temperatures.Temperate + EnvironmentConstants.Plains,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Desert,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Dungeon,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Forest,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Hills,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Marsh,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Mountain,
                EnvironmentConstants.Temperatures.Warm + EnvironmentConstants.Plains,
                GroupConstants.Dragon,
            };

            var levels = Enumerable.Range(1, 29).Select(lvl => lvl.ToString());
            var allEntries = entries.Union(levels);

            AssertEntriesAreComplete(allEntries);
        }
开发者ID:DnDGen,项目名称:EncounterGen,代码行数:49,代码来源:EncounterGroupsTests.cs

示例3: Use_RFC_3986_Encoding_For_Auth_Signature_Base

		public void Use_RFC_3986_Encoding_For_Auth_Signature_Base()
		{
			// reserved characters for 2396 and 3986
			var reserved2396Characters = new[] { ";", "/", "?", ":", "@", "&", "=", "+", "$", "," }; // http://www.ietf.org/rfc/rfc2396.txt
			var additionalReserved3986Characters = new[] { "!", "*", "'", "(", ")" };  // http://www.ietf.org/rfc/rfc3986.txt
			var reservedCharacterString = string.Join( string.Empty, reserved2396Characters.Union( additionalReserved3986Characters ) );
			
			// act
			var escapedString = OAuthTools.UrlEncodeRelaxed( reservedCharacterString );

			// assert
			Assert.Equal( "%3B%2F%3F%3A%40%26%3D%2B%24%2C%21%2A%27%28%29", escapedString );
		}
开发者ID:Bug2014,项目名称:RestSharp,代码行数:13,代码来源:oAuth1Tests.cs

示例4: CanDoUnionOnTwoItems

 public void CanDoUnionOnTwoItems()
 {
     var seq = new[] { 1, 2, 3 };
     seq.Union(4, 6).Should().Have.SameSequenceAs(1, 2, 3, 4, 6);
 }
开发者ID:marcosli,项目名称:simpledotnet,代码行数:5,代码来源:EnumerableFixture.cs

示例5: CanDoUnionOnSingleItem

 public void CanDoUnionOnSingleItem()
 {
     var seq = new[] { 1, 2, 3 };
     seq.Union(4).Should().Have.SameSequenceAs(1, 2, 3, 4);
 }
开发者ID:marcosli,项目名称:simpledotnet,代码行数:5,代码来源:EnumerableFixture.cs

示例6: CanDoUnionOnArrayOfItems

 public void CanDoUnionOnArrayOfItems()
 {
     var seq = new[] { 1, 2, 3 };
     var seq2 = new[] { 4, 5, 6 };
     seq.Union(seq2).Should().Have.SameSequenceAs(1, 2, 3, 4, 5, 6);
 }
开发者ID:marcosli,项目名称:simpledotnet,代码行数:6,代码来源:EnumerableFixture.cs

示例7: should_union_sequences

        public void should_union_sequences()
        {
            var left = new[] {1, 2, 3};
            var right = new[] {4, 3, 5};

            IEnumerable<int> unionResult = left.Union(right);

            // please update variable value to fix the test.
            IEnumerable<int> expectedUnionResult = new[] { 1, 2, 3 };

            Assert.Equal(expectedUnionResult, unionResult);
        }
开发者ID:chenbojian,项目名称:01_NewbieVillage,代码行数:12,代码来源:24_LinqBasics.cs


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