开发者

How to remove stuff from a list in C#?

I have a list of structs:

list<structure>;

But I want to remove the specific stuff by ID.

Example: item with ID 55.

So how I can reomve a stuff from list?

I have an ID in the struct as public string s开发者_JS百科tuffID;

How can I do this?


To remove everything with an ID of 55:

List<Structure> list;
list.RemoveAll(structure => structure.ID == 55);


list = list.Where(item => item.id != 55).ToList();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜