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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -