In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to use LINQ nesting". In daily operation, I believe many people have doubts about how to use LINQ nesting. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about how to use LINQ nesting. Next, please follow the editor to study!
An example of LINQ nesting:
Using System; using System.Linq Class P {static void Main () {var customer = new [] {new {PKId= "123456", Name= "admin", Pwd= "123456", Group= "123456"}, new {PKId= "002", Name= "user", Pwd= "user", Group= "003"}, new {PKId= "003", Name= "geust", Pwd= "guest", Group= "004"}, new {PKId= "004", Name= "aa", Pwd= "123456", Group= "002"} New {PKId= "005", Name= "bb", Pwd= "123456", Group= "002"}, new {PKId= "006", Name= "cc", Pwd= "123456", Group= "002"},} Var groups = new [] {new {PKId= "001", depict= "* permissions"}, new {PKId= "002", depict= "Administrator"}, new {PKId= "003", depict= "publish Information"}, new {PKId= "004", depict= "only browsing permissions"}} Var data = from word2 in groups where word2.depict = "administrator" / / select new {quanxian = word2.depict, Name = from word in customer where word.Group==word.PKId select word}; var first = data.First (); Console.WriteLine ("{0}, {1}", first.quanxian, first.Name) }} / / here is the output: administrator, System.Linq.Enumerable+ WhereArrayIterator`1 [f _ _ AnatomousType0`4 [system .string, System.String,System.String,System.String]]
Analysis of LINQ nesting problems:
See? the value of Name is its name IEnumerator.
The correct nesting method for LINQ should be:
Var data = from word2 in groups where word2.depict = = & at this point, the study on "how to use LINQ nesting" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.