Console Application on Reflection in C# 1.1 and 2.0 (Dot Net)

Google+ Pinterest LinkedIn Tumblr +

// Refjlection in C#
using System;

using System.Reflection;

namespace reflection

{

class reflection

{

public static void Main()

{

Type t=typeof(reflec);

Type t1=typeof(sec);

MemberInfo []b=t.GetMembers();

            MemberInfo []c=t1.GetMembers();            

foreach(MemberInfo a in b)

{

Console.WriteLine(a.ReflectedType+”  “+a.DeclaringType+”  “+a.Name+” = “+a.MemberType);

}

foreach(MemberInfo a in c)

{

Console.WriteLine(a.ReflectedType+”  “+a.DeclaringType+”  “+a.Name+” = “+a.MemberType);

}

Console.ReadLine();

}

}

class reflec

{

public void del(){}

public void welcome(){}

}

class sec:reflec

{

public int a=5;

public sec(int a){}

public void cosec(){}

}

}

Share.

About Author

Leave A Reply