LINQ in C# - Examples - Concat - Concatenating

  • The concatenation operators allow multiple input sequences of the same type to be concatenated into a single output sequence.
  • Example
string[] FirstSeq = { "Adams",
                                    "Arthur",
                                    };
            string[] SecondSeq = {"Buchanan",
                                    "Bush", };
            IEnumerable<string> sequence = FirstSeq.Concat(SecondSeq) ;

            foreach (var item in sequence)
                Console.WriteLine(item);

            Console.ReadLine();
//Output
Adams
Arthur
Buchanan
Bush

No comments:

Post a Comment

Framework Fundamentals - String - Comparing Strings

In comparing two values, the .NET Framework differentiates the concepts of equality comparison and order comparison . Equality compariso...