過濾陣列重覆的使用方式

  • 983
  • 0

過濾陣列重覆的使用方式

char[] chr = new char[] { ',' };
string[] strlist = str.Split(chr, StringSplitOptions.RemoveEmptyEntries);

IEnumerable noduplicates = strlist.Distinct();

foreach (string str in noduplicates)

{

................................

}

過濾陣列重覆的使用方式

char[] chr = new char[] { ',' };
string[] strlist = str.Split(chr, StringSplitOptions.RemoveEmptyEntries);

IEnumerable<string> noduplicates = strlist.Distinct();

 foreach (string str in noduplicates)

{

................................

}