Union two string arrays in CSharp
Description
The following code shows how to union two string arrays.
Example
// ww w . j ava 2s. c o m
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
public class MainClass{
public static void Main(string[] args){
String[] First = { "One", "Two", "Two", "Three", "Four" };
String[] Second = { "Three", "Four", "Five", "Six" };
var ShowUnion = First.Union(Second);
Console.WriteLine("Union:");
foreach (String ThisElement in ShowUnion)
Console.WriteLine(ThisElement);
}
}
The code above generates the following result.