Wednesday, April 16, 2014

Next we look at the example GroupBy var personList = GetPersonList (); var personListGroupBy = pers


Let's look at an example of instructions.
We first create a fake data source, analog read database. public static List <Person> GetPersonList () {return zählwaage new List <Person> () {new Person () {ID = 1, Name = "Kirk", Address = "aaaa", Birthday zählwaage = new DateTime (1985,6,8 ), Introduction = "aaaa", Phone = "0927896456", Group = "A"}, new Person () {ID = 2, Name = "John", Address = "bbbb", Birthday = new DateTime (1972,1 , 3), Introduction = "aaaa", Phone = "0927111111", Group = "A"}, new Person () {ID = 3, Name = "David", Address = "cccc", Birthday = new DateTime (1964 , 7,13), Introduction = "aaaa", Phone = "0927222222", Group = "B"}, new Person () {ID = 4, Name = "Steven", zählwaage Address = "dddd", Birthday = new DateTime zählwaage (1982,6,1), Introduction = "aaaa", Phone = "0927333333", Group = "B"}, new Person () {ID = 5, Name = "Jason", Address = "eeee", Birthday = new DateTime (1983,10,3), zählwaage Introduction = "aaaa", Phone = "0927444444", Group = "A"}, new Person () {ID = 6, Name = "Titan", Address = "ffff", Birthday = new DateTime (1987,7,2), Introduction = "aaaa", Phone = "0927555555", Group = "C"}, new Person () {ID = 7, Name = "Sophia", Address = "gggg ", Birthday = new DateTime (1981,3,27), Introduction =" aaaa ", Phone =" 0927666666 ", Group =" A "}, new Person () {ID = 8, Name =" Mary ", Address = "hhhh", Birthday = new DateTime (1982,12,18), Introduction = "aaaa", Phone = "0927777777", Group = "D"}, new Person () {ID = 9, Name = "Tom", Address = "iiii", Birthday = new DateTime (1983,9,23), zählwaage Introduction = "aaaa", Phone = "0927888888", Group = "B"}, new Person () {ID = 10, Name = "Julia ", Address =" jjjj ", Birthday = new DateTime (1975,3,18), Introduction =" aaaa ", Phone =" zählwaage 0927999999 ", Group =" zählwaage A "},};}
First we look at ToLookup example var personList = GetPersonList (); var personListLookUp = personList.ToLookup zählwaage (i => i.Group); / / Execute query immediately personList.RemoveAll (i => true); foreach (var personGroup zählwaage in personListLookUp) {Console.WriteLine ("Group: {0}", personGroup.Key); foreach (var person in personGroup) {Console.WriteLine ("ID: {0}, Name: {1}", person.ID, person.Name);}}
Implementation of the results: Group: A ID: 1, Name: Kirk ID: 2, Name: John ID: 5, Name: Jason ID: 7, Name: Sophia ID: 10, Name: Julia Group: B ID: 3, Name: David ID: 4, Name: Steven ID: 9, Name: Tom Group: C ID: 6, Name: Titan Group: D ID: 8, Name: Mary
Next we look at the example GroupBy var personList = GetPersonList (); var personListGroupBy = personList.GroupBy (i => i.Group); / / Do not execute query personList.RemoveAll (i => true); foreach (var personGroup in personListGroupBy) / / Do query now {Console.WriteLine ("Group: {0}", personGroup.Key); foreach (var person in personGroup) {Console.WriteLine ("ID: {0}, Name: {1} ", person.ID, person.Name);}}
Finally, attach a ToDictionary example, var personList = GetPersonList (); var personListDictionary = personList.ToDictionary (i => i.ID); personList.RemoveAll (i => true); foreach (var person in personListDictionary) {Console . WriteLine ("ID: {0}, Name: {1}", person.Key, person.Value.Name);}
Title: Enter the title points tribes Home RSS My Favorites Login Posts tagged ADO.NET ASP.NET C # CSS IIS JQuery Other SQL System Template Tip Tool WCF All tab Stats Posts 72 to respond to several 116 citations 0 JQuery article categories zählwaage ADO.NET (1) (rss) ASP.NET zählwaage (15) (rss) C # (22) (rss) CSS (1) (rss) IIS (1) (rss) Javascript (5) (rss) JQuery (2) (rss) KB (8) (rss) Other (1) (rss) Security (1) (rss) SQL (1) (rss) System (1) (rss) Tip (3) (rss) Tool (12) (rss) WCF (7) (rss) Monthly article in March 2014 (1) December 2013 (1) August 2013 (3) April 2013 (3) November 2012 (1) June 2012 (5 ) May 2012 (1) March 2012 (3) August 2011 (2) July 2011 (2) May 2011 (1) December 2010 (1) September zählwaage 2010 (2) August 2010 (4) July 2010 (2) June 2010 (4) May 2010 (3) April 2010 (9) March 2010 (1) January 2010 (3) 2009 In December (5) November 2009 (1) October 2009 (2) August 2009 (1) June 2009 (4) May 2009 (2) April 2009 (2) 2008 December (3) Latest Comments re: [Tip] use DropBox as the Git Repository: learned, thank you very much ~ ~ ~ very easy to use with Dropbox ~ ~ ~ finally be resolved without paying the square .... by Github Mr Zhang re:. [Tool] using gsyncit sync outlook and google calendar: I also have the same problem, I was before Outlook 2013 / Win 8 will be more .... by Ah Fei re: [JQuery] Ajax also ! can Mock Web Service has not yet developed can also test whether the operation of the web: Terrific share Mock Unit Test is really a good thing Ah by Blackie1019 re: using Team Foundation Server Management Software Development Life Cycle (1) - install TFS!!!! (Basic Version): zählwaage Small wind to offensive ALM Well XD by 91 re: [C #] using Process.StandardOutput when reading the output data, the need to pay attention to grammar execution sequence: public class a {public int add (int a, int b) {.... by 123 re: [C #] The synchronization method to rewrite asynchronous method: Will the "Event Based asynchronous model and based on non-synchronous mode .... by Chu's wandering re IAsyncResult: [ C #] using the Setup Project, modify Config settings during installation: Hello, I do based on the information you provide, but how it can not change the value of the configuration file, but also look pointing. by zf_fz re: [C #] DateTime output Republic of China: Thank doubts you are really talented by Chung re: [CSS] display: differences hidden in:: none and visibility print dddddddddddd by dddddddddddd re: [C #] on the Function of parameters for authentication : Thanks for sharing such a great article by Zhang Xiao Dai's nagging


No comments:

Post a Comment