How can anonymous types be created using LINQ with lambda syntax?

前端 未结 1 1886
长情又很酷
长情又很酷 2020-12-31 04:52

I have a LINQ query that uses lambda syntax:

var query =
    books
        .Where(book => book.Length > 10)
        .OrderBy(book => book.Length)


        
相关标签:
1条回答
  • 2020-12-31 05:19

    Like this:

    var query =
        books
            .Where(book => book.Length > 10)
            .OrderBy(book => book.Length)
            .Select(book => new { Book = book.ToUpper() });
    
    0 讨论(0)
提交回复
热议问题