码迷,mamicode.com
首页 > 其他好文 > 详细

LINQpad 用法汇总

时间:2014-09-22 15:25:32      阅读:319      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   2014   sp   cti   on   log   

 

bubuko.com,布布扣

 

// C# Expression
//Courses
// .Join (
// CourseSections,
// course => course.CourseId,
// section => section.CourseId,
// (course, section) => course
// )
// .Where (course => (course.Type == 3))

// C# Statement(s)
var courseInfo = from course in Courses
join section in CourseSections
on course.CourseId equals section.CourseId into MyLeftJoin
from result in MyLeftJoin.DefaultIfEmpty()
select course;
var courseType3 = courseInfo.Where(course=>course.Type == 3);
courseType3.Dump();

// C# Program
//void Main()
//{
// var courseInfo =GetCourseInfo();
// courseInfo.Dump();
//}
//
//public class CourseInfo{
// public int CourseId{get;set;}
// public int SectionId{get;set;}
//}
//
//public List<CourseInfo> GetCourseInfo(){
// var courseInfo = (from course in Courses
// from section in CourseSections
// where course.CourseId== section.CourseId
// select new CourseInfo {
// CourseId =course.CourseId,
// SectionId =section.SectionId
// }).ToList();
// return courseInfo;
//}

LINQpad 用法汇总

标签:blog   http   io   ar   2014   sp   cti   on   log   

原文地址:http://www.cnblogs.com/niaowo/p/3985906.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!