[Mono-dev] Extract method name from IEnumerator

Joachim Ante joe at unity3d.com
Sun Oct 5 07:18:45 EDT 2008


> The method's name is always MoveNext to conform to
> System.Collections.IEnumerator, but the declaring type of the method
> will be named after the original method.
>
> For example:
>
> class Test {
> 	static IEnumerable<int> Foo ()
> 	{
> 		yield return 42;
> 	}
> }
>
> The enumerator's type will be named `<Foo>c__IteratorN`. The issue is
> that this name can probably be changed as will by gmcs, but it looks
> like you can get the method's original name from its generated type
> name.

Has the behaviour of this changed? With Mono 1.2.5 I am getting "Test 
+<>c__CompilerGenerated0


> JB summarized it nicely, you can use name inside <.> as original  
> method name, there is couple of issue with it though.
> It may change in the future and it ignores generic method and  
> method overloads. Therefore if you need better name mapping you  
> have to use our debug symbol file.

Are there functions i can call to do a lookup of the function name,  
should i parse the whole file myself or add some function to mono to  
do it?

Best regards,
Joachim Ante


More information about the Mono-devel-list mailing list