reflection_param.htm

using System;
using System.Reflection;
//using string_module;
//csc get_constructor_param.cs
namespace ex_indexer_1
{
public class get_type
{
public void process(string str)
{
Assembly asm = Assembly.LoadFrom(str);
Type[] all_type = asm.GetTypes();
foreach(Type e in all_type)
{
Console.WriteLine("Found : {0} ", e);
}
Type t_cl = all_type[0];
Type t_cl_1 = all_type[1];
Console.WriteLine("\t Class Name {0} ",t_cl.Name);
Console.WriteLine("\t Class Name {0} ",t_cl_1.Name);
//
ConstructorInfo[] all_ct = t_cl.GetConstructors();
Console.WriteLine("--Constructor looped {0} ",t_cl.Name);
foreach(ConstructorInfo ci in all_ct)
{
ParameterInfo[] cs_p = ci.GetParameters();
//nested forfor loop
for(int i = 0; i < cs_p.Length; i++) {

Console.WriteLine( "\tParam name : " + cs_p[i].Name);
Console.WriteLine("\tParam Type : " + cs_p[i].ParameterType.Name);
Console.WriteLine("\tParam Attributes : " + " : " + cs_p[i].ParameterType.Attributes);
}
}
}
}//end of get_type
class test
{
static void Main()
{
String str = "";
Console.WriteLine("You may use either of two or any exe");
Console.WriteLine(@"C:\MySharp\reflection\ex1\reflection_typeof_operator.exe");
Console.WriteLine(@"C:\MySharp\reflection\ex1\get_assembly_constructor_type.exe");
Console.WriteLine(@"C:\MySharp\reflection\ex1\instance_constructor.exe");
Console.Write("Enter Here : " );
str =Console.ReadLine();
if (str !="")
{ get_type gt = new get_type();
gt.process(str);
}
else return;
Console.ReadLine();
}
}
}//end of namespace