Quick Way to Get Rid of Duplicates

Quick Way to Get Rid of Duplicates

What a great thing .Net 3.5+ is.  Thanks to the advent of Linq, we can now get rid of duplicated values from an array extremely easily without having to code your brains out.


Dim TmpArray() As String = New String() {"VW", "Audi", "BMW", "Chevy", "VW", "Audi"}

Dim Qry = (From n In TmpArray.Distinct Select n).ToList()

Kevin Pirnie
22 Years of PC and server maintenance & over 17 years of web development/design experience; you can rest assured that I take every measure possible to ensure your computers are running to their peak potentials. I treat them as if they were mine, and I am quite a stickler about keeping my machines up to date and optimized to run as well as they can.