[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / test-anon-154.cs
blob554072198500462c600d8562e92d27daa5a704df
1 using System;
3 public class Class
5 string Property { get { return " Property"; } }
7 string Method ()
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;
20 return innerFunc ();
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")
35 return 1;
37 return 0;