I have a LINQ query that uses lambda syntax:
var query =
books
.Where(book => book.Length > 10)
.OrderBy(book => book.Length)
I would like to create an anonymous type to store the projection, similar to:
var query = from book in books
where book.Length > 10
orderby book
select new { Book = book.ToUpper() };
How do I "select new" in lambda syntax ?
Thanks,
Scott
Like this:
var query =
books
.Where(book => book.Length > 10)
.OrderBy(book => book.Length)
.Select(book => new { Book = book.ToUpper() });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With