blob: 178f81fc0d3f35d5ec167d79a410db51a0a11ef4 (
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
33
34
35
36
37
38
|
// Type parameters with constraints: check whether we can invoke
// things on the constrained type.
using System;
interface I
{
void Hello ();
}
class J
{
public void Foo ()
{
Console.WriteLine ("Foo!");
}
}
class Stack<T>
where T : J, I
{
public void Test (T t)
{
t.Hello ();
t.Foo ();
}
}
class Test
{
}
class X
{
public static void Main()
{
}
}
|