using System;
using System.Reflection;
using System.Reflection.Emit;
public class MyTypeClass
{
public class Myclass1
{
}
public class Myclass2
{
}
protected class MyClass3
{
}
protected class MyClass4
{
}
}
public class TypeMain
{
public static void Main()
{
Type myType =(typeof(MyTypeClass));
Type[] myTypeArray = myType.GetNestedTypes(BindingFlags.Public|BindingFlags.Instance);
Console.WriteLine("The number of nested public classes is {0}.", myTypeArray.Length);
DisplayTypeInfo(myTypeArray);
}
public static void DisplayTypeInfo(Type[] myArrayType)
{
for(int i=0;i {
Type myType = (Type)myArrayType[i];
Console.WriteLine("The name of the nested class is {0}.", myType.ToString());
}
}
}