LINQ equivalent of List.Find()?

前端 未结 3 776
情书的邮戳
情书的邮戳 2021-02-03 12:51

I\'m looking at some code that takes an IEnumerable and converts it to a List so it can use List.Find(predicate):

var myEnumerable = .         


        
3条回答
  •  北海茫月
    2021-02-03 13:33

    Or you can do the following way:

    var match = myEnumerable.Where(value => value.Aaa == aaa && value.Bbb == bbb)
                            .FirstOrDefault();
    

提交回复
热议问题