2 using System
.Collections
.Generic
;
5 // Tests caching of closed generic anonymous delegates
9 public static decimal Average
<TSource
> (this IEnumerable
<TSource
> source
, Func
<TSource
, decimal> selector
)
11 return source
.Select (selector
).Average
<decimal, decimal, decimal> ((a
, b
) => a
+ b
, (a
, b
) => a
/ b
);
14 static TResult Average
<TElement
, TAggregate
, TResult
> (this IEnumerable
<TElement
> source
,
15 Func
<TAggregate
, TElement
, TAggregate
> func
, Func
<TAggregate
, TElement
, TResult
> result
)
16 where TElement
: struct
17 where TAggregate
: struct
18 where TResult
: struct
20 throw new InvalidOperationException ();
23 public static void Main ()