csharp 【C#】LINQ.Joinの提示

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 【C#】LINQ.Joinの提示相关的知识,希望对你有一定的参考价值。

// でかい配列
var test1 = Enumerable.Range(1, 200000).Select(it => new { ID = it, Name = "aikazu" + it });
var test2 = Enumerable.Range(1, 100000).Select(it => new { ID = it, Name = "aikazu" + it });

// メソッド式 INNER JOIN 
var result1 = test1.Join(test2, it => it, it => it, (outer, inner) => outer).ToArray();

// メソッド式 LEFT JOIN 
var result2 = test1.GroupJoin(test2, it => it, it => it, (outer, inner) => outer).ToArray();

// クエリ式 INNER JOIN 
var result3 = (from t1 in test1
			   join t2 in test2 on t1 equals t2
			   select t1).ToArray();

// クエリ式 LEFT JOIN 
var result4 = (from t1 in test1
			   join t2 in test2 on t1 equals t2
			   into z
			   from it in z.DefaultIfEmpty(new { ID = 0, Name = "null" })
			   select t1).ToArray();

以上是关于csharp 【C#】LINQ.Joinの提示的主要内容,如果未能解决你的问题,请参考以下文章

csharp 【C#】LINQ.OrderByの提示

csharp 【C#,表格】的DataGridViewの列の工具提示に改行を入れる

csharp 来自http://stackoverflow.com/questions/1122942/linq-to-sql-left-outer-join-with-multiple-join-c

csharp 【C#】的XmlWriterの编码

csharp C#のビット计算の仕方

csharp C#5.0 async / awaitでの主要メソッドの书き方