Search list of objects based on object variable

后端 未结 4 749
独厮守ぢ
独厮守ぢ 2021-02-13 14:30

I have a list of objects. These objects have three variables, ID, Name, & value. There can be a lot of objects in this list, and I need to find one based on the ID or Name

4条回答
  •  醉话见心
    2021-02-13 14:56

    var find = TextPool.FirstOrDefault(x => x.Name == "test");
    if (find != null)
    {
        find.Name = "Value";
    }
    

提交回复
热议问题