Hey, On Sun, Nov 7, 2010 at 3:08 PM, kostaz <[email protected]> wrote: > According to Cecil FAQ (http://www.mono-project.com/Cecil:FAQ), the > below code "will insert the following code into *each* methods of > *each* type of the assembly":
Note that this FAQ hasn't been updated to Cecil 0.9, that you should get from: http://github.com/jbevain/cecil You can read some HOWTO on the wiki there. > Two questions: > (1) What about another 'foreach' for all assembly.Modules: > foreach (ModuleDefinition module in assembly.Modules) > foreach (TypeDefinition type in module.Types) If you want to be thorough, yes. However, multi module assemblies are rare (VS doesn't know how to deal with them), most of the time you'll work with assemblies with one manifest module. > (2) What is it the peculiar type.Name "<Module>"? Should we *always* > skip it when working with Cecil? It depends on what you want to achieve. The <Module> type is a special type which has to be the first type of the assembly, and it's supposed to hold «global methods and global fields» (read static fields and static methods). Some compiler emit methods and fields there, you might want to deal with them as well. Jb -- -- mono-cecil
