下载此文档

C# 2008 LINQ基础- LINQ语法.doc


文档分类:IT计算机 | 页数:约10页 举报非法文档有奖
1/10
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/10 下载此文档
文档列表 文档介绍
C# 2008 LINQ 基础- LINQ 语法 Posted on 2008-02-22 13:56 sunrack 阅读(614) 评论(1) 编辑收藏网摘所属分类: C# 2008 一、 LINQ 查询符列表 Query Operators Meaning in Life from, in Used to define the backbone for any LINQ expression, which allows you to extract a subset of data from a fitting container. where Used to define a restriction for which items to extract from a container. select Used to select a sequence from the container. join, on, equals, into Performs joins based on specified key. Remember, these “ joins ” do not need to have anything to do with data ina relational database. orderby, ascending, descending Allows the resulting subset to be ordered in ascending or descending order. group, by Yields a subset with data grouped bya specified value. 另外还有一些没有操作符号,而是以扩展函数(泛型函数)的方式提供的函数: 用不同方式产生结果集: Reverse<>(), ToArray<>(), ToList<>() 集合操作: Distinct<>(), Union<>(), Intersect<>() 统计函数: Count<>(), Sum<>(), Min<>(), Max<>() 二、使用 Enumerable 获取 Counts 为了使用这些 Enumerable 扩展函数, 一般把 LINQ 查询表达式用括号括起来, 先转换为 IEnumerable<T> 兼容的对象。 static void GetCount() { string [] currentVideoGames ={ "Morrowind" , "BioShock" , "Half Life 2: Episode 1" , "The Darkness" , "Daxter" , "System Shock 2" }; // Get count from the query. int numb = (from g in currentVideoGames where >6 orderby g select g).Count< string >(); // numb is the value 5. ( "{0} items honor the LINQ query." , numb); } 三、定义演示的实例 class Car

C# 2008 LINQ基础- LINQ语法 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数10
  • 收藏数0 收藏
  • 顶次数0
  • 上传人yixingmaob
  • 文件大小66 KB
  • 时间2016-12-23