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


C# System.Linq.Concat方法代码示例

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


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

示例1: ShouldAddBeans

 public void ShouldAddBeans()
 {
     var cargo = new BeanCargo();
     var existingBeans = new[] { new Bean(1, Suit.Blue), new Bean(2, Suit.Blue), };
     cargo.AddBeans(existingBeans);
     var beansToAdd = new[] {new Bean(3, Suit.Blue)};
     cargo.AddBeans(beansToAdd);
     CollectionAssert.AreEqual(existingBeans.Concat(beansToAdd), cargo);
 }
开发者ID:r-icarus,项目名称:TWAwayDay,代码行数:9,代码来源:BeanCargoTest.cs

示例2: AndWithOrsBecomesBoolWithShould

        public void AndWithOrsBecomesBoolWithShould()
        {
            var expected1 = new[] { new RangeCriteria("field1", memberInfo, RangeComparison.LessThan, 2), new RangeCriteria("field2", memberInfo, RangeComparison.GreaterThan, 4) };
            var expected2 = new[] { new RangeCriteria("field3", memberInfo, RangeComparison.LessThan, 2), new RangeCriteria("field4", memberInfo, RangeComparison.GreaterThan, 4) };

            var actual = QueryCriteriaRewriter.Compensate(AndCriteria.Combine(OrCriteria.Combine(expected1), OrCriteria.Combine(expected2)));

            var boolActual = Assert.IsType<BoolCriteria>(actual);

            Assert.Equal(boolActual.Should.AsEnumerable(), expected1.Concat(expected2));
            Assert.Empty(boolActual.Must);
            Assert.Empty(boolActual.MustNot);
        }
开发者ID:pickypg,项目名称:ElasticLINQ,代码行数:13,代码来源:QueryCriteriaRewriterTests.cs

示例3: TestHeap

 private static void TestHeap(DHeapType type, int rank)
 {
     var fixture1 = new [] { 0, 0, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9 };
     var fixture2 = new [] { 9, 9, 9, 2, 4, 5, 10, 15, 0, 8, 13, 19 };
     SequenceUtils.Shuffle(fixture1);
     var heap = new DHeap<int>(fixture1, type, rank);
     foreach (var item in fixture2) {
         heap.Add(item);
     }
     var combined = fixture1.Concat(fixture2).ToArray();
     combined = type == DHeapType.Max
         ? combined.OrderByDescending(a => a).ToArray()
         : combined.OrderBy(a => a).ToArray();
     Assert.AreEqual(combined.Count(), heap.Count);
     foreach (var item in combined) {
         Assert.AreEqual(item, heap.GetPeak());
     }
     Assert.AreEqual(0, heap.Count);
 }
开发者ID:nyk0r,项目名称:algorithms,代码行数:19,代码来源:DHeapTest.cs

示例4: GenerateCore

        protected override object GenerateCore(Project project, Column column)
        {
            var color = new[] { "white", "black", "blue", "green", "silver", "indigo", "gold", "golden" };
            var productFirst = new[] { "span", "dan", "scot", "lam", "new", "hot", "rank", "don", "ding", "dong", "ron", "ran", "an", "round", "re", "fin", "red", "run", "ran", "ap", "can", "don", "dam", "dom", "big", "ice", "drip", "duo", "inch", "fun", "free", "fresh", "grave", "groove", "hay", "hot", "hat", "jay", "joy", "key", "kay", "med", "bio", "geo", "alpha", "k-", "kin", "kon", "konk", "kan", "lot", "lat", "mat", "med", "math", "move", "phys", "bio", "geo", "alpha", "lexi", "beta", "nim", "nam", "open", "ope", "over", "ozer", "onto", "dento", "vento", "quad", "quote", "qvo", "quo", "stat", "stim", "stan", "sub", "sun", "sum", "super", "san", "sao", "sil", "con", "sol", "solo", "sail", "dalt", "salt", "san", "son", "ton", "tin", "tan", "temp", "tam", "tamp", "trans", "tran", "tree", "true", "trio", "trust", "tres", "tris", "u-", "uno", "una", "uni", "viva", "via", "vaia", "voya", "villa", "vila", "vol", "volt", "x-", "xxx-", "tripple", "double", "single", "y-", "year", "good", "hot", "strong", "zen", "s-", "zot", "zath", "zer", "zun", "zon", "zoo", "zone", "zoom", "zam", "zaam", "zim", "zum", "zumma", "fase" };
            var productMiddle = new[] { "dan", "lam", "don", "din", "ron", "ran", "an", "rem", "fin", "red", "run", "ran", "ap", "can", "don", "dam", "dom", "hot", "hat", "jay", "joy", "key", "kay", "lot", "lat", "mat", "to", "nim", "nam", "ove", "oze", "ot", "quad", "qvo", "quo", "stat", "sun", "san", "sao", "sil", "sol", "solo", "sail", "san", "son", "ton", "tin", "tan", "tam", "trax", "dub", "go", "hot", "zen", "zun", "zoz", "zoo", "zam", "zim", "zum" };
            var productLast = new[] { "tex", "tax", "dex", "lux", "ron", "ex", "dox", "dax", "com", "find", "lax", "ity", "fan", "phase", "nix", "ing", "tom", "zap", "lex", "kix", "dom", "tam", "core", "tone", "trax" };
            var productBoth = new[] { "tech", "fix", "fax", "bam", "eco", "fresh", "cof", "soft", "top", "tip", "job", "stock", "string", "strong", "sing", "flex", "plus", "in", "it", "is", "lam", "la", "lab", "light", "air", "touch", "tough", "home", "hold", "warm" };

            var prefix = productFirst.Concat(productLast).Concat(color).ToArray();
            var suffix = productLast.Concat(productBoth).ToArray();
            var middle = productMiddle;

            var prefixName = Random.NextFromArray(prefix);
            var middleName = Random.NextFromArray(middle);
            var suffixName = Random.NextFromArray(suffix);
            int n = Random.NextInt32(0, 9);
            if (n <= 1)
            {
                return ConvertUtilities.Camel(prefixName) + middleName + suffixName;
            }
            if (n <= 2)
            {
                return ConvertUtilities.Camel(prefixName) + "-" + ConvertUtilities.Camel(suffixName);
            }
            if (n <= 3)
            {
                return ConvertUtilities.Camel(prefixName) + suffixName;
            }
            if (n <= 4)
            {
                return ConvertUtilities.Camel(prefixName) + " " + ConvertUtilities.Camel(middleName) + suffixName;
            }
            if (n <= 5)
            {
                return ConvertUtilities.Camel(prefixName) + " " + ConvertUtilities.Camel(suffixName);
            }

            return ConvertUtilities.Camel(prefixName) + suffixName;
        }
开发者ID:meziantou,项目名称:Meziantou.DataGenerator,代码行数:39,代码来源:BrandNameGenerator.cs


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