Updated with review feedback.
[mono.git] / mcs / tests / test-anon-138.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq.Expressions;
4
5 class Foo<T>
6 {
7         public bool ContainsAll<U> (IEnumerable<U> items) where U : T
8         {
9                 Func<bool> d = delegate () {
10                         foreach (U item in items) {
11                                 Expression<Func<bool>> e = () => !Contains (item);
12                                 if (!e.Compile () ())
13                                         return false;
14                         }
15                         
16                         return true;
17                 };
18
19                 return d ();
20         }
21
22         public bool Contains (T t)
23         {
24                 return false;
25         }
26 }
27
28 class Program
29 {
30         public static int Main ()
31         {
32                 var x = new Foo<int> ();
33                 return x.ContainsAll (new [] { 4, 6, 78 }) ? 0 : 1;
34         }
35 }
36