This simple class
public class Test<T> { public static void A(Window wa, Window wb) { wa.Closed += (s, e) => wb.Close(); } }
Gets the compiled data (I use Reflector to decompile):
public class Test<T> { [CompilerGenerated] private sealed class <>c__DisplayClass1 { public Window wb; public void <A>b__0(object s, EventArgs e) { this.wb.Close(); } } public static void A(Window wa, Window wb) { wa.Closed += delegate(object s, EventArgs e) { base.wb.Close(); }; } }
What is the meaning of base ? Why is <>c__DisplayClass1 generated if it has never been used? Is this a reflector error?
Edit: Indeed, it seems that reflector optimization is not very good in this case, disabling decompiled code optimization makes sense:
public class Test<T> { public Test() { base..ctor(); return; } public static void A(Window wa, Window wb) { <>c__DisplayClass1<T> CS$<>8__locals2; CS$<>8__locals2 = new <>c__DisplayClass1<T>(); CS$<>8__locals2.wb = wb; wa.Closed += new EventHandler(CS$<>8__locals2.<A>b__0); return; } [CompilerGenerated] private sealed class <>c__DisplayClass1 {
source share