Possible Duplicate:
Remove duplicates from array
How to get distinct values from an array in C#
You can find the distinct values in an array using the Distinct function. The Distinct function takes the array as an input parameter and returns another array that consists only of the unique, or non-duplicate, elements.
You could use the .Distinct()
extension method.
var collectionWithDistinctElements = oldArray.Distinct().ToArray();
Using Distinct()
function:
var distinctArray = myArray.Distinct().ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With