Recently a colleague asked me for advice about using LINQ to group and sort a table in a specific way. It contains multiple columns by which to group, and a single time-stamp column by which to sort. Consider this data as an example: The first step is to group by Column1, and then sort the […]
Fun with C# and LINQ – Part 2
Last time I discussed how two lists of financial transactions can be matched by defining a custom extension method. The used types were hard-coded, which is fine as long as you don’t plan to reuse the code. It is not hard to generalize the extension method using generic type parameters. These would be TFirst for […]
Fun with C# and LINQ
MSDN magazine columnist Ted Neward recently wrote an inspiring two-part article showing how use of a functional programming language can lead to new insights into a problem, even if the actual implementation is done in a mostly procedural language like C#. In the first part, he sets up the problem of reconciling two lists (local […]