LINQ in Action roller

Chunking a Collection into Groups of Three

Raw data for a LINQ query doesn’t always come in the form you want. Recently, I had some data like this: string [] source = new [] { "EW" , "Eric" , "8:00" , "DW" , "Dave" , "9:00" , "JA" , "Jim" , "8:00" }; You want to transform the above collection of strings into a collection of anonymous objects that are easier to work on, so you need to write a query that operates on groups of three. To solve this problem, you can take advantage that the Select extension method has an overload that passes an Read More...
Published Tuesday, August 19, 2008 5:27 AM by Eric White's Blog
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication