+92 332 4229 857 99ProjectIdeas@Gmail.com

LINQ Distinct() Method (Vb.net)



The following code shows you how to remove reapeating elements from your array, i.e, if your array contains 2 , 1 , 3 , 2 , 5, now you want remove 2 which comes two times in your array. after applying Distinct method the output would be like that 2 , 1 , 3 , 5. See the code below.







Dim intArr As Integer() = {2, 1, 2, 3, 7, 5, 10, 9}

Dim query = intArr.Distinct()

  For Each i In query
  
       Console.Write(i.ToString() & " ")

  Next

Output of the program is :
2 1 3 7 5 10 9

see this in c#.net

0 comments: