How to remove the item in list

Posted by Gidijala.Dinesh under ASP.NET on 10/15/2014 | Points: 10 | Views : 392 | Status : [Member] | Replies : 1
we can delete a list item by the single step using for loop

for(i=0;list.count-i>i;i++)
{

if(list[i].name=="")
list.RemoveAt(i);

}





Responses

Posted by: kgovindarao523-21772 on: 10/24/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,
you can use below logic.

list.RemoveAll(x => x.name == string.Empty);


Thank you,
Govind

Gidijala.Dinesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response