blob: 014f2e05f07e4f71e4cd20819815c1fa02e35308 (
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
|
using System;
class T {
T Me { get { calls ++; return this; } }
T GetMe () { foo ++; return this; }
int blah = 0, calls = 0, foo = 0, bar = 0;
static int Test (T t)
{
t.Me.Me.blah ++;
t.GetMe ().GetMe ().bar++;
if (t.blah != 1)
return 1;
if (t.bar != 1)
return 2;
if (t.calls != 2)
return 3;
if (t.foo != 2)
return 4;
return 0;
}
static int Main ()
{
T t = new T ();
int result = Test (t);
Console.WriteLine ("RESULT: {0}", result);
return result;
}
}
|