' sample data Dim sample = {1, 2, 3, 4, 5} ' using "query syntax" Dim squares = From number In sample Select number * number ' same thing using "method syntax" Dim squares =sample.Select(Function (number) number * number)
我们也可以一次投影多个结果
Dim numbersAndSquares = From number In sample Select number, square = number * number Dim numbersAndSquares = sample.Select(Function (number) New With {Key number, Key .square = number * number})