blob: c741ea76da6853b878f0277f03d8c76e5ced366f (
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
39
40
41
42
43
44
45
|
interface I
{
void SetValue (int arg);
}
public struct S : I
{
public int Value;
public void SetValue (int v)
{
Value = v;
}
}
class C
{
static void Method<T> (ref T t) where T : struct, I
{
dynamic d = 25;
t.SetValue (d);
}
public static int Main ()
{
int? x = null;
dynamic y = 50;
int v = x.GetValueOrDefault(y);
if (v != 50)
return 1;
var s = new S ();
dynamic d = 5;
s.SetValue (d);
if (s.Value != 5)
return 2;
Method (ref s);
if (s.Value != 25)
return 3;
return 0;
}
}
|