You can traverse the nested types like this:
if(tipo.HasNestedTypes) // where tipo is your type from the main foreach
loop
{
foreach (TypeDefinition nestedType in tipo.NestedTypes)
{
//do what you want to here..
}
}
On Thu, Oct 18, 2012 at 5:21 PM, aixeiger <[email protected]> wrote:
> this is the code that i use for go through the methods
>
> AssemblyDefinition asem = AssemblyFactory.GetAssembly(args[0]);
> foreach (TypeDefinition tipo in asem.MainModule.Types)
> {
> foreach (MethodDefinition met in tipo.Methods)
> {
> System.Console.WriteLine(met.Name);
> }
> foreach(PropertyDefinition pro in tipo.Properties)
> {
> System.Console.WriteLine(pro.Name);
> }
> foreach (FieldDefinition fie in tipo.Fields)
> {
> System.Console.WriteLine(fie.Name);
> }
> System.Console.WriteLine(tipo.FullName);
> }
>
>
> then when i run the application i get this
>
>
>
> <Module>
> Dispose
> InitializeComponent
> button1_Click
> button2_Click
> button3_Click
> button4_Click
> components
> label1
> button1
> pictureBox1
> button2
> button3
> button4
> texta1
> label2
> pictureBox2
> se
> prop
> Car.Form1
> Dispose
> InitializeComponent
> button1_Click
> components
> label1
> textBox1
> button1
> button2
> button3
> Car.Form2
> get_Default
> Default
> defaultInstance
> Car.Properties.Settings
> carsettings
> Car.Propiedades
> get_ResourceManager
> get_Culture
> set_Culture
> ResourceManager
> Culture
> resourceMan
> resourceCulture
> Car.Properties.Resources
> Main
> Car.Program
> Car.Simulacion
>
> that's are all the elements to my application but in the last two just
> show the name of the classes and my ask is how i can go through the methods
> inside the classes and propierties and to the access modifiers and the
> other things to this classes have
>
> if you can help me please!
>
> thanks!
>
>
> --
> --
> mono-cecil
--
Vidisha Ghosh
--
--
mono-cecil