VB.Net Lambda request

I know I can change a query like this

Dim myList As List(Of Tickets) = (From a In db.myTable Where a.ID = id AndAlso a.IsOnline = True).ToList 

in lambda

 Dim myList as List(of Tickets) = db.Where(Function(x) x.ID = id ANDAlso a.IsOnline = true).ToList 

How to write a lambda version and tell her to create a new object with the results? eg:

 Dim myList As List(Of Tickets) = (From a In db.myTable Where a.ID = id AndAlso a.IsOnline = True Select New TicketType With { .Id = a.rsID.ToString, .Title = a.rsTitle}).ToList 
+4
source share
1 answer

You are looking for the Select() method:

 .Select(Function(x) New TicketType With { ... }) 
+5
source

All Articles