Reflection in csharp
what is Reflection?whenever we use that Reflection in application?...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Sep 30, 2010, 6:26 PM
Manikavelu VelayuthamPosted Sep 30, 2010, 5:37 AM
So to know the indepth of that assembly, reflection is used.
Through reflection you can iterate all the properties, methods, or events available in it.
Eg:-
string sAssemblyName = GetValidAssembly(args);
Assembly assem = Assembly.LoadFrom(sAssemblyName);
Type[] types = assem.GetTypes();
foreach (Type t in types)
{
try
{
Console.WriteLine("Type information for:" + t.FullName);
Console.WriteLine("\tBase class = " + t.BaseType.FullName);
Console.WriteLine("\tIs Class = " + t.IsClass);
Console.WriteLine("\tIs Enum = " + t.IsEnum);
Console.WriteLine("\tAttributes = " + t.Attributes);
}