Difference between revisions of "Microsoft LINQ"
From Richard's Wiki
| Line 2: | Line 2: | ||
* [http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx LINQ to XML - 5 Minute Overview] | * [http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx LINQ to XML - 5 Minute Overview] | ||
* [http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx 101 Linq samples (MSDN)] | * [http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx 101 Linq samples (MSDN)] | ||
| + | * Linq extension method to flatten a hierarchy: | ||
| + | |||
| + | using System.Collections.Generic; | ||
| + | using System.Linq; | ||
| + | using Model.Entity; | ||
| + | namespace Util | ||
| + | { | ||
| + | public static class RatesWorksheetSectionExtensions | ||
| + | { | ||
| + | public static IEnumerable<RatesWorksheetSection> Flatten(this IEnumerable<RatesWorksheetSection> source) | ||
| + | { | ||
| + | return source.Concat(source.SelectMany(p => p.Children.Flatten())); | ||
| + | } | ||
| + | } | ||
| + | } | ||
Revision as of 21:06, 12 July 2011
- Media:Microsoft Press - Introducing Microsoft LINQ.zip
- LINQ to XML - 5 Minute Overview
- 101 Linq samples (MSDN)
- Linq extension method to flatten a hierarchy:
using System.Collections.Generic;
using System.Linq;
using Model.Entity;
namespace Util
{
public static class RatesWorksheetSectionExtensions
{
public static IEnumerable<RatesWorksheetSection> Flatten(this IEnumerable<RatesWorksheetSection> source)
{
return source.Concat(source.SelectMany(p => p.Children.Flatten()));
}
}
}