程序设计Csharp程序设计 (55).pdf
《程序设计Csharp程序设计 (55).pdf》由会员分享,可在线阅读,更多相关《程序设计Csharp程序设计 (55).pdf(22页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、C#程序设计 Programming in C#LINQ概述 C#程序设计程序设计 1、LINQ的功能 2、LINQ的使用方法 1.什么是LINQ?3 在程序中的数据和数据库的数据相反,保存在类对象或结构中的数据差异很大。没有通用的查询语言从数据结构中获取数据。1.什么是LINQ?4 LINQ,语言集成查询(Language Integrated Query)是一组用于c#和Visual Basic语言的扩展。它允许编写C#或Visual Basic代码以查询数据库相同的方式操作内存数据。使用LINQ,程序员可以从数据库、程序对象的集合以及XML文档等查询数据。1.什么是LINQ?5 如下是L
2、INQ使用示例。在这段代码中,被查询的数据源是简单的int数组。语句中查询的定义就是from和select关键字。查询在最后的foreach语句中进行。intint scoresscores =newnew intint 9797,9292,8181,6060 ;IEnumerableIEnumerable scoreQueryscoreQuery =from scorefrom score inin scoresscores wherewhere scorescore 8080 select scoreselect score;foreachforeach (intint i i inin
3、scoreQueryscoreQuery)ConsoleConsole.WriteWrite(i i +););1.什么是LINQ?6 如下是LINQ使用示例。在这段代码中,被查询的数据源是简单的int数组。语句中查询的定义就是from和select关键字。查询在最后的foreach语句中进行。intint scoresscores =newnew intint 9797,9292,8181,6060 ;IEnumerableIEnumerable scoreQueryscoreQuery =from scorefrom score inin scoresscores wherewhere s
4、corescore 8080 select scoreselect score;foreachforeach (intint i i inin scoreQueryscoreQuery)ConsoleConsole.WriteWrite(i i +););1.什么是LINQ?7 如下是LINQ使用示例。在这段代码中,被查询的数据源是简单的int数组。语句中查询的定义就是from和select关键字。查询在最后的foreach语句中进行。intint scoresscores =newnew intint 9797,9292,8181,6060 ;IEnumerableIEnumerable s
5、coreQueryscoreQuery =from scorefrom score inin scoresscores wherewhere scorescore 8080 select scoreselect score;foreachforeach (intint i i inin scoreQueryscoreQuery)ConsoleConsole.WriteWrite(i i +););2.LINQ提供程序 8 LINQ可以和各种类型的数据源一起工作,比如SQL数据库、XML文档等等。对于每一种数据源类型,在其背后一定有根据该数据源类型实现LINQ查询的代码模块,这些代码模块被叫做L
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 程序设计Csharp程序设计 55 程序设计 Csharp 55
限制150内