Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-etree-10.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c0a9a07c8bdf53fcddf469ea7f22ae445547ad4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

class Foo<T>
{
	public bool ContainsAll<U> (IEnumerable<U> items) where U : T
	{
		foreach (U item in items) {
			Expression<Func<bool>> e = () => !Contains (item);
			if (!e.Compile () ())
				return false;
		}

		return true;
	}

	public bool Contains (T t)
	{
		return false;
	}
}

class Program
{
	public static int Main ()
	{
		var x = new Foo<int> ();
		return x.ContainsAll (new [] { 4, 6, 78 }) ? 0 : 1;
	}
}