lambda with linq cheat sheet in c# code example

Example 1: linq cheat sheet

Dim query = from m in Manufacturers
	where m.Name = "Trek" 
	select m

Dim lambda = Manufacturers.Where(function(m) m.Name = "Trek").Select(function(m) m)

Example 2: linq cheat sheet

var query = from m in Manufacturers
	where m.Name == "Trek" 
	select new {Name = m.Name, Key = m.ManufacturerId};

var lambda = Manufacturers.Where(m => m.Name == "Trek").Select(m=> new {Name = m.Name, Key = m.ManufacturerId});

Example 3: linq cheat sheet

var query = from m in Manufacturers
	where m.Name == "Trek" 
	select m;

var lambda = Manufacturers.Where(m => m.Name == "Trek").Select(m => m);

Tags:

Misc Example