public class Class1
{
public void GetAllClassesAndMethodsOfAssembly()
{
//Code to load Assembly
Assembly assem1 = Assembly.Load(AssemblyName.GetAssemblyName("MyAssembly"));
//Another Way
Assembly assem2 = Assembly.Load("MyAssembly");
//Get List of Class Name
Type[] types = assem1.GetTypes();
foreach(Type tc in types)
{
if (tc.IsAbstract)
{
Response.Write("Abstract Class : " + tc.Name);
}
else if (tc.IsPublic)
{
Response.Write("Public Class : " + tc.Name);
}
else if (tc.IsSealed)
{
Response.Write("Sealed Class : " + tc.Name);
}
//Get List of Method Names of Class
MemberInfo[] methodName = tc.GetMethods();
foreach (MemberInfo method in methodName)
{
if (method.ReflectedType.IsPublic)
{
Response.Write("Public Method : " + method.Name.ToString());
}
else
{
Response.Write("Non-Public Method : " + method.Name.ToString());
}
}
}
}
}