Language-Integrated Query (LINQ) is the name of a set of technologies that are built on the direct integration of query functionality into the C # language (as well as Visual basic and any other possible. NET language). with LINQ, the query is now a high-level language construct, just like classes, methods, events, and so on.
For developers writing queries, the most obvious "language integration" part of LINQ is the query expression.query syntax introduced in C # 3.0. " The query expression is written using the declarative query syntax introduced in C # 3.0. You use the same basic query expression pattern to query and transform data in SQL databases, ADO datasets, XML documents and streams, and. NET collections. While LINQ and SQL statements are very similar so they are well understood.
The following example shows the full query operation. complete operations include creating a data source, defining a query expression, and executing a query in a foreach statement.
classlinqqueryexpressions{Static voidMain () {//specify the data source. int[] scores =New int[] { the, the,Bayi, - }; //Define the query expression.ienumerable<int> scorequery = fromScoreinchscoreswhereScore > the Selectscore; //Execute the query. foreach(intIinchscorequery) {Console.Write (i+" "); } }}
OUTPUT:97 92 81
C # Learning (6)--linq Learning