Pergunta

Dim orders = From tt In testTable _
             Order By tt.Item("OrderNumber") _
             Select tt.Item("OrderNumber"), tt.Item("OrderId")

This is breaking. Is there a way to do this? I would have thought it was easy enough. Obviously, I thought wrong....

Foi útil?

Solução

Dim orders = From tt In testTable _
     Order By tt.Item("OrderNumber") _
     Select New With {.OrderNo = tt.Item("OrderNumber"), .OrderId = tt.Item("OrderId")}

If I got the VB.NET syntax right

This returns an anonymous type, if you want to return an existing type you replace With with that type.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top