How toget class name by assembly name

Posted by Oswaldlily under C# on 8/24/2012 | Points: 10 | Views : 799 | Status : [Member] | Replies : 1
whatever Assembly name is I should get its corresponding class name.........

My assemly name can be "windowsapplication1"/"windowsApplication2/windowsapplication3/.............windowsapplication10.....

By calling this assembly name I shd get its class name...How is it possible




Responses

Posted by: Gopesh9 on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
//Code to load Assembly

Assembly assembly = Assembly.Load(AssemblyName.GetAssemblyName("Assembly1"));

//Get List of Class Name
Type[] Ctypes = assem1.GetTypes();

foreach(Type tc in Ctypes)
{
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);
}
}


G. S.
.Net Developer

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response