博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LinQ In Action 学习第四章
阅读量:5235 次
发布时间:2019-06-14

本文共 1404 字,大约阅读时间需要 4 分钟。

第四章开始了 LinQ to Object 的讲解(Entity 用了很多linq的语法,如果Linq 掌握好了Entity很好学了):

第四第五章 需要多加练习例子,熟练linq 的语法。

第四章的例子做完了,主要讲了一些常用的Linq 语法。

1.select select many

2. orderby 

3. group, join group, left join, cross join, inner join, nested query

4.where .......

 5. take() skip()

写了几个小例子:

 var publishersource = from bookbb in books

                                   select new
                                   {
                                       Name = from pub in Publishers
                                              where pub.Name == bookbb.Publisher.Name
                                              select pub,
                                       bookbb.Title,
                                       bookbb.Price
                                   };
             var groupsource = from groupbook in books
                               group groupbook by groupbook.Publisher into PublisherGroupName
                               select new { Name = PublisherGroupName.Key.Name, Books = PublisherGroupName };
             var groupjoinsource = from publishersor in Publishers
                              join booksor in books
                              on publishersor equals booksor.Publisher into PublisherGroup
                              select new { Name = publishersor.Name, Books = PublisherGroup };
             var leftjoingroup = from publisher in Publishers
                                   join booksor in books
                                   on publisher equals booksor.Publisher into GroupPublisher
                                   from book in GroupPublisher.DefaultIfEmpty()
                                   select new { Publisher = publisher.Name,
                                                Book = book == default(Book)?"no books":book.Title };
             var crossingJoin = from publisher in Publishers
                                from book in books
                                select new
                                {
                                    Name = publisher.Name,
                                    Title = book.Title
                                };

第五章主要讲性能:

1. nongeneric collection need to : Cast, ofType,  explicitly convert to object.

2.分组使用多个元素  group by more than one characters.

转载于:https://www.cnblogs.com/recordlife/p/4218771.html

你可能感兴趣的文章
[转]ASP.NET MVC Domain Routing
查看>>
自媒体
查看>>
Linux文件系统结构
查看>>
深入理解Java虚拟机
查看>>
(算法)等概率选出m个整数
查看>>
jvm内存溢出的三种情况以及解决办法
查看>>
两个UIView添加同一个手势只有最后一个有用
查看>>
THINKPHP的U方法带入JS变量的解决方案
查看>>
Flip Game
查看>>
CentOS7操作系统初始化
查看>>
hadoop 及hbase zookeeper 经常出现问题
查看>>
【原】PNG的使用技巧
查看>>
android studio 使用SVN 锁定文件,防止别人修改(基于Android studio 1.4 )
查看>>
4412 uboot启动分析
查看>>
熟用TableView
查看>>
IO模型《六》IO模型比较分析
查看>>
Android 博客园客户端 (七)登录功能
查看>>
PHP动态页面 生产静态页 方法二
查看>>
NSOperation 代码,阐述NSOperation一般功能和重要功能
查看>>
androidstudio 2.3.3 jni过程汇总(2):2、使用so文件
查看>>