csharp linq演示

Posted

tags:

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

var id = 1;
var query = database.Posts    // your starting point - table in the "from" statement
   .Join(database.Post_Metas, // the source table of the inner join
      post => post.ID,        // Select the primary key (the first part of the "on" clause in an sql "join" statement)
      meta => meta.Post_ID,   // Select the foreign key (the second part of the "on" clause)
      (post, meta) => new { Post = post, Meta = meta }) // selection
   .Where(postAndMeta => postAndMeta.Post.ID == id);    // where statement
var id = 1;
var query =
   from post in database.Posts
   join meta in database.Post_Metas on post.ID equals meta.Post_ID
   where post.ID == id
   select new { Post = post, Meta = meta };

以上是关于csharp linq演示的主要内容,如果未能解决你的问题,请参考以下文章

csharp #LINQ到#XPO

csharp Linq On Dataset

csharp [DataTable]到LINQ的数组列表

csharp Linq加入多个可空列

csharp C#/ LINQ /选择/在

csharp EntityFrameworkLinqtoSQLStatementTable LINQ