2 using System
.Collections
.Generic
;
3 using System
.Runtime
.CompilerServices
;
11 class CallerMemberTest
: I
13 object field
= TraceStatic ("field");
16 : this (TraceStatic (".ctor"))
20 CallerMemberTest (object arg
)
24 static IEnumerable
<int> Enumerator ()
26 TraceStatic ("Enumerator");
35 public void GenericMethod
<T
> ()
37 Trace ("GenericMethod");
40 public int this [string arg
] {
46 public bool Property
{
53 public static implicit operator CallerMemberTest (int i
)
55 TraceStatic ("op_Implicit");
56 return new CallerMemberTest ();
59 public void Trace(string expected
, [CallerMemberName
] string member
= ";;")
61 Console
.WriteLine (member
);
62 if (expected
!= member
)
63 throw new ApplicationException (member
);
66 public static object TraceStatic(string expected
, [CallerMemberName
] object member
= null)
68 Console
.WriteLine (member
);
70 if (expected
!= member
as string)
71 throw new ApplicationException (string.Format ("`{0}' != `{1}'", expected
, member
as string));
76 public static void Main ()
78 var c
= new CallerMemberTest ();
85 a
= () => TraceStatic ("Main");
88 foreach (var e
in Enumerator ()) {
92 OO
= TraceStatic ("Main")
95 var l
= (from x
in "ab" select TraceStatic ("Main")).ToList ();
97 c
.GenericMethod
<long> ();
104 CallerMemberTest op
= 1;