Search code examples
c#decompiling

what expression <>c__DisplayClass9 means in c#


I've used decompiler to get the sources of some library in C#. One of unknown (to me) constructs it produced is the following:

Action action = null;
<>c__DisplayClass9 class2;
action = new Action(class2, (IntPtr) this.<OptimizeVisuals>b__6);

Things like <>c__DisplayClass9 or (IntPtr) this.<OptimizeVisuals>b__6 I just cannot grok. What's more, this expression cannot be compiled with C# compiler, so I need to come up with something more friendly. Tried to google parts of this, but with no luck. Could you give me some hints? It seems it can have something to do with anonymous methods, but that's my best guess.

Thanks in advance.

EDIT: Maybe my initial question was not very clear about what I need to achieve. So just to reemphasize: I need to convert the code mentioned to the normal C# code, doing the same thing as before de-compilation. My task is to change certain things in the library I'm decompiling, while keeping other functionality (like the mentioned one) intact. This is really important thing for me, so I'd really appreciate if somebody could help me with this.


Solution

  • The compiler generates some members for auto-implemented properties, anonymous methods and such. To prevent collisions with your own names, the compiler uses names that are illegal in C# (but still legal in the CLR).