Updated with review feedback.
[mono.git] / mcs / tests / test-anon-141.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4
5 // Tests caching of closed generic anonymous delegates
6
7 static class C
8 {
9         public static decimal Average<TSource> (this IEnumerable<TSource> source, Func<TSource, decimal> selector)
10         {
11                 return source.Select (selector).Average<decimal, decimal, decimal> ((a, b) => a + b, (a, b) => a / b);
12         }
13
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
19         {
20                 throw new InvalidOperationException ();
21         }
22
23         public static void Main ()
24         {
25         }
26 }
27