Hi all,
I guess it is the most trivial question, but failed to find/google the
answer...   :(
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":

    AssemblyDefinition assembly =
AssemblyFactory.GetAssembly(pathBin);
    foreach(TypeDefinition type in assembly.MainModule.Types)
    {
        if(type.Name != "<Module>")
        {
            //Gets all methods of the current type
            foreach(MethodDefinition method in type.Methods)
            {
    ...

Two questions:
(1) What about another 'foreach' for all assembly.Modules:
    foreach (ModuleDefinition module in assembly.Modules)
        foreach (TypeDefinition type in module.Types)
            ...
(2) What is it the peculiar type.Name "<Module>"? Should we *always*
skip it when working with Cecil?

Thanks, Kosta.

-- 
--
mono-cecil

Reply via email to