什么是LINQ? [英] What is LINQ?
本文介绍了什么是LINQ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是LINQ?
推荐答案
LINQ是一种语言结构,它允许人们使用类似SQL的语法进行排序,过滤并以其他方式重新排列一组相似类型的对象.
来自Microsoft文档:
LINQ使查询成为C#和Visual Basic中的一流语言构造.您可以使用语言关键字和熟悉的运算符针对强类型对象集合编写查询.下图显示了对C#中具有完整类型检查和IntelliSense支持的SQL Server数据库的部分完成的LINQ查询.
标题链接到X"是指使用LINQ查询类型为X的数据源的功能. LINQ to SQL,LINQ to XML等
WRT从SQL数据库中获取数据,首先需要一个DataContext.这将建立您的数据源.然后,您需要一些代表表的类.然后您可以执行以下操作:
IQueryable< customer> custQuery =
来自客户的客户
其中cust.City ==伦敦"
选择客户;
从这里开始: http://msdn.microsoft.com/en-us/library/bb386940.aspx [ ^ ]
LINQ is a language construct that allows one to use an SQL-like syntax to sort, filter and otherwise rearrange a group of objects of a similar type.
From the Microsoft documentation:
LINQ makes a query a first-class language construct in C# and Visual Basic. You write queries against strongly typed collections of objects by using language keywords and familiar operators. The following illustration shows a partially-completed LINQ query against a SQL Server database in C# with full type checking and IntelliSense support.
The title "Link To X" refers to the ability to use LINQ to query a data source of type X, e.g. LINQ to SQL, LINQ to XML, etc.
WRT fetching data from a SQL database, you will first need a DataContext. This establishes the source for your data. Then you need some classes that are representative of your tables. Then you can do this:
IQueryable<customer> custQuery =
from cust in Customers
where cust.City == "London"
select cust;
Start here: http://msdn.microsoft.com/en-us/library/bb386940.aspx[^]
在这里,我发布了有关Linq基本操作的一些信息,包括选择,插入,删除,更新.
http://suhasharidas.blogspot.in/2012/08/create- linq-to-sql-connection-with.html [ ^ ]
here i am posting some thing about Linq basic operation select, insert, delete, update.
http://suhasharidas.blogspot.in/2012/08/create-linq-to-sql-connection-with.html[^]
这篇关于什么是LINQ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文