public void Leak(bool useArray, int max) { DoCopy one = null; if (useArray) { int[] work; one = delegate { work = new int[max]; }; } else { one = delegate { int xans = (max + 1) * max / 2; }; } Console.WriteLine("Here goes..."); one(); Console.WriteLine("... made it"); }
public void Leak(bool useArray, int max) { DoCopy one; { int answer = 0; int[] work; CopyIt = delegate { Value = answer; }; one = delegate { work = new int[max]; foreach(int x in work) answer += x; }; } one(); }
public void Leak(bool useArray, int max) { DoCopy one; { int answer = 0; int[] work; CopyIt = delegate { Value = answer; }; one = delegate { work = new int[max]; foreach (int x in work) { answer += x; } }; } one(); }