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

Ansible warning on jinja2 braces on when -

Parsing a protocol message from Go by Java -

javascript - Replicate keyboard event with html button -