首页 > 代码库 > LINQpad 用法汇总
LINQpad 用法汇总
// 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 用法汇总