Reflector and compiler code
I have a dll that I parse into Reflector then create a class. The class contains code that does not compile in Visual Studio.
I am using this ILAG code, but how can I generate a higher level C # from this.
It seems the result and IEnumerator is generating things like <>1__state;
in IL that won't compile.
Does anyone know how I can generate a class from reflector that contains this type of IL?
Is there a reflex addon that will resolve this?
private sealed class <Rule_Document>d__0 : IEnumerable<HtmlTag>, IEnumerable, IEnumerator<HtmlTag>, IEnumerator, IDisposable
{
private int <>1__state;
private HtmlTag <>2__current;
public HtmlParser <>4__this;
private int <>l__initialThreadId;
public HtmlTag <htmlTag>5__1;
a source to share
This IL is from the iterator block. Iterators horrible written by hand, and the base of the IL iterator block is a testament to the reality that the compiler is doing for you. Be grateful you didn't have to do it yourself!
You could try to combine this mostly from MoveNext()
, but don't expect miracles. You may also find that renaming fields (to get rid of things like prefixes <>
) makes a big difference.
Nevertheless; I expect the best thing to do is understand what the code is trying to do and stop trying to just steal borrow their implementation.
a source to share