Filtering collection with LINQ

后端 未结 4 1202
醉话见心
醉话见心 2021-02-02 02:19

Let\'s say we have a collection of Person objects

class Person 
{
     public string PersonName {get;set;}
     public string PersonAddress {get;set;}    
}
         


        
4条回答
  •  难免孤独
    2021-02-02 03:10

    Can't you just do

    personList.Where(x => x.PersonName == "YourNameHere").ToList() ?
    

提交回复
热议问题