Revision 92f18b56 trunk/Pithos.Core/Agents/CollectionExtensions.cs
b/trunk/Pithos.Core/Agents/CollectionExtensions.cs | ||
---|---|---|
55 | 55 |
/// </summary> |
56 | 56 |
public static class CollectionExtensions |
57 | 57 |
{ |
58 |
public static IEnumerable<T> Replace<T>(this IEnumerable<T> list,Func<T,bool> match, Func<T,IEnumerable<T>> replace)
|
|
58 |
public static IEnumerable<T> Replace<T>(this IEnumerable<T> list,Func<T,bool> match, Func<T,IEnumerable<T>> generate)
|
|
59 | 59 |
{ |
60 | 60 |
foreach (var item in list) |
61 | 61 |
{ |
62 | 62 |
if (match(item)) |
63 |
foreach (var newItem in replace(item))
|
|
63 |
foreach (var newItem in generate(item))
|
|
64 | 64 |
{ |
65 | 65 |
yield return newItem; |
66 | 66 |
} |
Also available in: Unified diff