samedi 25 avril 2015

Where to go to view System.Collections.Generic IL code in ildasm?


My curiosity piqued by this question, I went in search of the implementation of List.Clear(). When I ran ildasm on System.Collections.dll like so:

cd c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5
"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\ildasm.exe" System.Collections.dll

and looked at System.Collections.Generic.List`1::Clear : void(), this is what I found:

.method public hidebysig newslot virtual final 
         instance void  Clear() cil managed
{
  // Code size       1 (0x1)
  .maxstack  8
  IL_0000:  ret
} // end of method List`1::Clear

That's not what I'm looking for.

I'm aware that some .NET dll's are a level of indirection so that different versions of the framework can be directed to. If that's the case here, how do I figure out where the actual code is? Or if there is something else going on, tips on how to go about using ildasm for this kind of task are appreciated. I'm more capable at using ildasm for looking at my own stuff, but am not experienced at using it to examine framework code.


Aucun commentaire:

Enregistrer un commentaire