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

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

image - python get coordinates (pixels) of corresponding points from clicks -