Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

linq cheat sheet

Dim query = from m in Models
		join p in PartNumbers on m.ModelId equals p.ModelId
		where m.Name.Contains("Domane")
		select new with {.ModelId = m.ModelId, .ModelName = m.Name, .PartNumber = p.InventoryPartNumber }

Dim lambda = Models.Join(PartNumbers, function(m) m.ModelId, function(p) p.ModelId, function(m,p) new with {.m = m, .p = p} ) _
					.Where( function(j) j.m.Name.Contains("Domane")) _
					.Select(function(j) new with {.ModelId = j.m.ModelId, .ModelName = j.m.Name, .PartNumber = j.p.InventoryPartNumber})
Comment

linq cheat sheet

var query = from m in Models
		join p in PartNumbers on m.ModelId equals p.ModelId
		where m.Name.Contains("Domane")
		select new {m.ModelId, ModelName = m.Name, PartNumber = p.InventoryPartNumber };

var lambda = Models.Join(PartNumbers, m => m.ModelId, p => p.ModelId, (m, p) => new {m = m, p = p} )
					.Where( j => j.m.Name.Contains("Domane"))
					.Select(j => new {ModelId = j.m.ModelId, ModelName = j.m.Name, PartNumber = j.p.InventoryPartNumber});
Comment

linq cheat sheet

Dim query = from m in Manufacturers
	where m.Name = "Trek" 
	select new with {.Name = m.Name, .ManufacturerId = m.ManufacturerId}

Dim lambda = Manufacturers.Where(function(m) m.Name = "Trek").Select(function(m) new with {.Name = m.Name, .ManufacturerId = m.ManufacturerId})

Comment

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});
Comment

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)
Comment

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);

Comment

linq cheat sheet

This is best so far:
https://vslapp.files.wordpress.com/2011/11/linq-cheatsheet.pdf
Comment

PREVIOUS NEXT
Code Example
Csharp :: dispose await task c# 
Csharp :: f sharp make parameter mutable 
Csharp :: rename join table in many to many 
Csharp :: c# short 
Csharp :: user control equivalent event for form.shown c# 
Csharp :: Display all members of class using a for loop vb.net 
Csharp :: c# check if file is zero bytes 
Csharp :: when should i use struct rather than class in c# 
Csharp :: c# printwindow 
Csharp :: unity diference protected and virtual 
Csharp :: WPF TextBox input to All Caps 
Csharp :: Known Folders C# 
Csharp :: exception meaning in .net core 
Csharp :: how to change the volume of all sound effects in monogame 
Csharp :: razor preview 
Csharp :: custom player spawner mirror 
Csharp :: C# system dont let write txt file 
Csharp :: C# dictionnaries 
Csharp :: alpahbet incremnet in c# 
Csharp :: for loop cs 
Csharp :: expander vertical wpf 
Csharp :: How to get the value of an input button in an ASP.NET Core MVC controller 
Csharp :: check for held hey unity 
Csharp :: c# treeview keep selected node highlight 
Csharp :: runner dotnet trace inside docker container 
Csharp :: range to 01 
Csharp :: datagrid drop file wpf mvvm example 
Csharp :: convert web app to linux 
Csharp :: how to make a respaen script in unity 
Csharp :: asp.net razor get list without refresh 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =