02-微软新技术LinQ.pptVIP

  • 0
  • 0
  • 约 13页
  • 2016-12-21 发布于贵州
  • 举报
微 软 新 技 术 LinQ 下午: IEnumerable、IEnumerableT Query Expression LinQ Query Keywords IEnumerableT Select Where Average Contain Count Distinct First Query Keywords IEnumerableT From:Specifies a data source and a range variable where:Filters source elements based on one or more Boolean expressions separated by logical and || operators Select:Specifies the type and shape that the elements in the returned sequence will have when the query is executed. Orderby:The orderby will cause the elements in the returned sequence to be sorted according to the default comparer for the type. LinQ to SQL 微软新技术实验室--西安 Problem 强类型, 智能化, 编译器, 调试器 (指令式) 映射, 连接, 分组, 查询 (声明式) Data as Objects Objects as Data ?2008 Microsoft Thinkbank What is LINQ? Unified programming model for any data type/source Collections Database Relational Data XML Files Extendable for anything else * ?2008 Microsoft Thinkbank LINQ enabled ADO.NET LINQ Architecture XML Objects Relational Data .NET Language-Integrated Query (LINQ) * ?2008 Microsoft Thinkbank LINQ To Objects Working with collections Any one that implements IEnumerableT using System.Linq System.Core.Dll assembly int[] arr = new int[] {3,6,2,7,4,8,4 }; var arr2 = arr.where(x=x4); foreach (var v in arr2) { Console.WriteLine(v.ToString()); } int[] arr = new int[] {3,6,2,7,4,8,4 }; var arr2 = from n in arr where n 6 select n; foreach (var v in arr2) { Console.WriteLine(v.ToString()); } LINQ To Objects 数组(普通数组、自定义类数组) int[],string[],Users[] //assign directly ListT泛型列表 //Add Item QueueT泛型队列 //Enqueue Item StackT泛型栈 //Push Item LINQ To DataSet IEnumerableDataRow result = from cat in ds.Tables[0].AsEnumerable() where cat.Fieldstring(user_pwd)!=123 select cat; foreach (var n in result) { this.textBox1.Text += n.Fieldstring(user_name); } LINQ To SQL The DataContext type Entity col

文档评论(0)

1亿VIP精品文档

相关文档