LINQ SELECT OPERATOR
By Peter Bromberg
The Select operator performs a projection over a sequence. This sample uses select to return a sequence of just the names of a list of products.
public void Linqy()
{
List<Product> products = GetProductList();
var productNames =
from p in products
select p.ProductName;
Console.WriteLine("Product Names:");
foreach (var productName in productNames)
{
Console.WriteLine(productName);
}
}
LINQ SELECT OPERATOR (955 Views)