In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use Linq Select clause". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use the Linq Select clause.
Select data (SELECT)
The Linq Select clause specifies the form and content of the returned element. To retrieve a collection that contains the entire data source object, select the scope variable itself. To select multiple fields from a data source, you can use two methods:
1. In the Linq Select clause, specify the fields to include in the result. The compiler defines an anonymous type that has these fields as its properties. Such as:
Dim londonCusts4 = From cust In customers _ Where cust.City = "London" _ Order By cust.Name Ascending _ Select Name = cust.Name, Phone = cust.Phone
2. Define a named type that contains a specific field you want to include in the result, and create and initialize an instance of that type in the Linq Select clause. Use this option only if you must use these results outside the collection that returns them, or if you must pass them as parameters to a method call.
Dim londonCusts5 = From cust In customers _ Select New NamePhone With
{
.name = cust.Name, _ .Phone = cust.Phone
}
If no Linq Select clause is specified, the query returns a type based on all members of the current scope variable.
The Linq Select clause can reference any variable in the current scope, including scope variables identified in the From clause, any new variables created by the Aggregate, Let, Group By, or Group Join clause through aliases, or variables created by the previous Linq Select clause in the query expression. The Linq Select clause can also contain static values.
The Linq Select clause introduces a new set of scope variables for subsequent other clause clauses, while the previous range variables are no longer in the range, and a Linq Select clause in the query expression determines the return value of the query. For example:
Dim customerList = From cust In customers, ord In cust.Orders _ Select Name = cust.CompanyName / / introduce a new scope variable Total = ord.Total, ord.OrderID _ / / introduce a new range variable Where Total > 500000 / the following clause uses a new range ratio Select Name, OrderID so far, I believe you have a deeper understanding of "how to use the Linq Select clause", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.