Monday, 6 July 2015

Remove duplicate strings from a string or int array in C#

string[] spdfIn =
{ "abc", "xyz","abc", "def", "ghi", "asdf", "ghi","xd", "abc" };
 
spdfIn = spdfIn.Distinct().ToArray(); 


int[] int1={1,2,3,4,4,5,1};
int1=int1.Distinct().ToArray(); 

No comments:

Post a Comment