Using Linq select list inside list

前端 未结 4 1512
清歌不尽
清歌不尽 2021-02-04 04:08

Using LINQ how to select from a List within a List

public class Model
{
    public string application { get; set; }

    public List users { get; se         


        
4条回答
  •  悲&欢浪女
    2021-02-04 04:56

    You have to use the SelectMany extension method or its equivalent syntax in pure LINQ.

    (from model in list
     where model.application == "applicationname"
     from user in model.users
     where user.surname == "surname"
     select new { user, model }).ToList();
    

提交回复
热议问题