>
> > If that is only the reason for the 'MainModule' to be (and I hope this is
> > the *only* reason), then I'll use 'AssebmlyDefinition.Modules' always.
> > So, is it the *only* reason for 'MainModule' to be born?
>
> I don't think it's the only reason. Cecil mimics the ECMA-335 metadata
> format. The ECMA-335 specification defines one of the modules as
> special (the "manifest module"), so Cecil would naturally expose this.
>
> Whether the distinction between the main module and other modules
> makes a difference in your specific application is probably for you to
> know. When you iterate the types in an assembly, you should probably
> use the Modules collection rather than only looking into the
> MainModule if you want to support all possible .NET applications
>

Thanks for the detailed answer. In my project I aim to change *all* the
types and
*all* the methods in *all* the .NET assemblies and user supplied programs,
hence,
I will iterate on 'Modules' according to your suggestion.

-- 
--
mono-cecil

Reply via email to