c# - How to remove an string object from a list? -


i have 2 list of string header1 , header2

list<string> header1 = new list<string>(); header1.add("string1"); header1.add("string2"); header1.add("string3"); header1.add("string4"); 

and

    list<string> header2 = new list<string>();     header2.add("string1");     header2.add("string2"); 

i remove these entries "string1" , "string2" in header2 header1 ignoring case sensitivity.

any idea how either using linq or string operation well.

thanks

header1.removeall(x =>              header2.contains(x, stringcomparer.currentcultureignorecase)); 

Comments