In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about what Linq query expressions are like. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Linq query expression
As a result, the language design team designed a syntax more similar to SQL, called Linq query expressions. For example, the Linq query expression for our example could look like this:
Var locals = from c in customers where c.ZipCode = = 91822 select new {FullName = c.FirstName + "" + c.LastName, HomeAddress = c.Address}
Linq query expressions are built on the basis of the above language functions. In terms of syntax, they are completely transformed into the basic syntax that we have seen. For example, the above query can be converted directly to:
Var locals = customers.Where (c = > c.ZipCode = = 91822) .Select (c = > new {FullName = c.FirstName + "" + c.LastName, HomeAddress = c.Address})
Linq query expressions support many different "clauses", such as from, where, select, orderby, group by, let, and join. These clauses are first converted to equivalent operator calls, which are then implemented by extension methods. If the query syntax does not support clauses of the necessary operators, the close relationship between the query clause and the extension method that implements the operator makes it easy to combine the two. For example:
Var locals = (from c in customers where c.ZipCode = = 91822 select new {
FullName = c.FirstName + "" + c.LastName, HomeAddress = c.Address}) .count ()
In this way, we have managed to achieve the initial goal at the end (I am always very satisfied with this).
Thank you for reading! This is the end of this article on "what is the Linq query expression?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.