Reflection
using System;
using System.Windows.Forms;
using System.Reflection;
namespace Reflection1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public double d;
private void button1_Click(object sender, EventArgs e)
{
textBox1.Clear();
Assembly asm = Assembly.LoadFrom("rdll.dll");
Type[] t = asm.GetTypes();
for (int j = 0; j < t.Length; j++)
{
textBox1.Text = t[j].FullName;
textBox1.Text += "\r\n" + t[j].BaseType.ToString();
MethodInfo[] m = t[j].GetMethods();
for (int i = 0; i < m.Length; i++)
textBox1.Text += "\r\n" + m[i].ToString();
FieldInfo[] f = t[j].GetFields();
for (int i = 0; i < f.Length; i++)
textBox1.Text += "\r\n" + f[i].ToString();
ConstructorInfo[] c = t[j].GetConstructors();
for (int i = 0; i < c.Length; i++)
textBox1.Text += "\r\n" + c[i].ToString();
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
Type t = typeof(ClassG1);
textBox1.Text = t.FullName;
textBox1.Text += "\r\n" + t.BaseType.ToString();
MethodInfo[] m = t.GetMethods();
for (int i = 0; i < m.Length; i++)
textBox1.Text += "\r\n" + m[i].ToString();
FieldInfo[] f = t.GetFields();
for (int i = 0; i < f.Length; i++)
textBox1.Text += "\r\n" + f[i].ToString();
ConstructorInfo[] c = t.GetConstructors();
for (int i = 0; i < c.Length; i++)
textBox1.Text += "\r\n" + c[i].ToString();
}
}
}