5 string Property { get { return " Property"; }
}
9 string methodVariable
= "method variable";
11 Func
<string> outerAction
= () => {
12 // If methodVariable is not accessed here, the compiler does not crash
13 string unused
= methodVariable
;
15 string innerVariable
= "inner variable";
17 Func
<string, string> middleAction
= lambdaParameter
=> {
18 // If any of the variables referenced are removed, the compiler does not crash.
19 Func
<string> innerFunc
= () => lambdaParameter
+ innerVariable
+ Property
;
23 return middleAction ("> ");
26 return outerAction ();
29 public static int Main ()
31 Class c
= new Class ();
32 string s
= c
.Method ();
33 Console
.WriteLine (s
);
34 if (s
!= "> inner variable Property")