Tuesday, February 9, 2010

How to find Union of two string array in C#

Linq Made our life easy.
It is too simple to find Union of two array in c#
Below is the code


string [] array1= new string [] {"JON","JEMIN","MATT"};
string[] array2 = new string[] { "JEMIN", "SUHAS", "MATT" };
array1 = array1.Union(array2).ToArray();

2 comments:

Saurabh Gautam said...

Thanks a Lot!!!

ayush nautiyal said...

Hi,
Please give code without using union method also..

Thanks......................