Showing posts with label set operation in linq. Show all posts
Showing posts with label set operation in linq. Show all posts

Monday, 7 October 2013

Set Operations in LINQ

Set Operations in LINQ

We use following set operations in LINQ:-

Distinct

Distinct remove redundancy and show the unique records.



Figure 1

For example:-

int[] techaltum = { 1, 2, 3, 4, 3, 4, 5, 19, 89, 4, 8, 2 };
        IEnumerable<int> res = techaltum.Distinct();
        Response.Write("Result after Distinct <br/>");
        foreach (int data in res)
        {

            Response.Write(data+"<br/>");
              
        }