In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the anonymous types of Linq". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what are the anonymous types of Linq.
LINQ makes querying a first-class programming concept in A. NET, and the data being queried can be XML (LINQ to XML), Databases (LINQ to SQL, LINQ to Dataset, LINQ to Entities), and LINQ to Objects. LINQ is also extensible, allowing you to create custom LINQ data providers (such as LINQ to Amazon, LINQ to NHibernate, LINQ to LDAP). Here I will discuss some of the new language features and improvements in Cellular 3.0 that make LINQ so powerful.
Linq anonymous type
This language feature allows us to define embedded types without having to explicitly define a type. In other words, suppose we don't define a Point class, but instead use a Point object (that is, the type is anonymous). We can use the object initialization syntax mentioned above, but we don't have to specify a type name:
Var p = new {X = 0, Y = 2}
In VS2008, you can still use intelligence. So if you continue to use the variable p, you will get a list of properties of this Linq anonymous type.
Lambda expression
Anonymous methods have been introduced in Category 2.0, allowing you to write a block of code where a delegate is needed. Linq anonymous types provide the power of functional programming languages, and the syntax is concise. Lambda expressions provide a more concise syntax for writing anonymous methods. An Lambda expression is a list of parameters (which can be implicitly typed), followed by a = > symbol, followed by an expression or a block of statements.
As an example, we define a delegate type MyDeleg:
MyDeleg IsPositive = delegate (int num) {return num > 0;}
We can also use the new Lambda expression to write:
MyDeleg IsPositive = num = > num > 0; Thank you for reading. The above is the content of "what are Linq anonymous types?" after the study of this article, I believe you have a deeper understanding of what Linq anonymous types have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.