A baseball Linq-er


Derek Slager wrote an example to show off LINQ, language integrated query, using baseball.  For those who don't really follow sports, baseball has a state for literally everything.  While in Wrigley Field, I've heard people rattle off "He can bat a .405 against a left handed pitcher on every other thursday of the month."

Now what is linq?  Here is a quick example.  For more information, visit MSDN's LINQ project.

   1:  WriteRankedList(from game in games
   2:                  group game by game.WinningPitcher into g
   3:                  orderby g.Count() descending
   4:                  select g);

Now I just need to find where to score a hotdog in the middle of Winter.



The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.