Adds

Thursday, 13 June 2013

Get Unmatched Value Between Two Array In c#


Get Unmatched Value  Between Two Array In c#:


static void Main(string[] args)
        {
            var emp = new string[] { "Hasan", "Shohel", "Sajib", "Milan", "Saiful", "Shanta" };
            var att = new string[] { "Hasan", "Shohel", "Sajib" };

            var common = emp.Except(att);

            foreach (string s in common)
                Console.WriteLine(s);
            Console.ReadLine();
        }

Output:


For Match Value Just Use: Intersect.

                               var common = emp.Intersect(att);

 Output: 


 For All(Common &n Uncommon) value From Two Array Just Use: Union.
                                var common = emp.Union(att);

Output: