c# - Remove all value duplicates in array -
example array:
int[] s new = {1,2,3,1};
if use:
int[] inew = snew.distinct().toarray();
then out put:
{1,2,3}
but want out put:
{2,3}
you need select duplicate count == 1:
snew.groupby(x => x) .where(x => x.count() == 1) .select(x => x.first()) .toarray();
fiddle here
Comments
Post a Comment