c# - Distinct items in List -


i have excel spreadsheet trying populate list unique values. have found linqtoexcel prefer not use. @ there 2000 rows isn't much.

my thought was:

list<string> lst = new list<string>(); string item;  (i=2; i<2001; i++) {     item = ws.cells[i,3];     if(lst.**notinlist**(item))     {         lst.add(item);     } } 

i know there isn't notinlist(), hoping similar or idea.

use contains instead

list<string> lst = new list<string>(); string item;  (i=2; i<2001; i++) {     item = ws.cells[i,3];     if(!lst.contains(item))     {         lst.add(item);     } } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -