Friday, 10 August 2012

how to remove a value from list without using its index

Question:

"list<string>options=new list<string>{'a','b','c','d','e','f','g','h'};"

from this list i want to remove "e" (lets assume that 'i have dont know its index')

Solution:

* Just add all list values to a SET.
* We can directly remove values from set using remove() method.
* After that add this set to a particular list.

No comments:

Post a Comment

Labels