Linq Example 15-Distinct

4:57 AM
Linq Query:

//Distinct
            string[] strDays = { "Monday", "SaturDay", "Monday","Friday","TuesDay","SaturDay" };
            //Repeated Days" Monday,SaturDay

            var days = strDays.Distinct();
            foreach (var t in days)
            {
                Console.WriteLine(t.ToString());
            }


Output:
Monday
SaturDay
Friday
TuesDay

0 comments:

Post a Comment