First - Simple

Query
public void Linq58()
{
List products = GetProductList();

Product product12 = (
from p in products
where p.ProductID == 12
select p)
.First();

ObjectDumper.Write(product12);
}
Lambda Expression
public void Linq58()
{
List products = GetProductList();

Product product12 = (
from p in products
where p.ProductID == 12
select p)
.First();

ObjectDumper.Write(product12);
}
Output
ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000 UnitsInStock=86
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +