In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you the example analysis of Linq Library, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
C # 3.0 and Linq Project have been revealed on PDC 05. What is Linq? To put it simply, Linq is a language-level query syntax Library, which allows us to query variables in the language in a SQL-like way, such as array, Collections. As an example:
Static void ObjectQuery () {var people = new List () {new Person {Age=12, Name= "Bob"}, new Person {Age=18, Name= "Cindy"}, new Person {Age=13}}; var teenagers = from p in people where p.Age > 12 & & p.Age
< 20 select p; Console.WriteLine("Result:"); foreach(var val in teenagers) { Console.WriteLine(">Name = {0}, Age = {1} ", val.Name, val.Age);} Console.ReadLine ();} class Person {public int Age; public string Name;}
Person is a class. In the ObjectQuery function, a Collection of Person is created with Generic List. The vartype here is a new type of C # 3.0. from a language point of view, this type can be specified as any type, just like Variant. From a Complier point of view, it is a Lazy- determine type, and the real type is determined by Complier during compilation, and the following strange syntax is Linq.
Var teenagers = from p in people where p.Age > 12 & & p.Age < 20 select p
Do you think it looks like SQL? This code means that elements with Age greater than 12 and less than 20 are selected from people. In addition to this simple query, Linq also supports syntax such as Join,Distinct.
Basically, Linq is just a group of Library,C# 3.0 and VB.NET 9.0 Complier uses this Library to implement the above new syntax, all special grammars will be compiled by the compiler to use Linq Library programs.
The above is all the content of this article "sample Analysis of Linq Library". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.