控制台的下的反射出Button控件的属性,方法,事件

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Windows.Forms;

namespace ReflectionTextBox
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("属性列表-----------------------");
            Type t = typeof(System.Windows.Forms.TextBox);
            PropertyInfo[] p = t.GetProperties();
            foreach (PropertyInfo i in p)
            {
                Console.WriteLine(i);
            }
            Console.ReadLine();
            Console.WriteLine("方法列表-----------------------");
            MethodInfo[] m = t.GetMethods();
            foreach (MethodInfo i in m)
            {
                Console.WriteLine(i);
            }
            Console.ReadLine();
            Console.WriteLine("事件列表-----------------------");
            EventInfo[] e = t.GetEvents();
            foreach (EventInfo i in e)
            {
                Console.WriteLine(i);
            }
            Console.ReadLine();

        }
    }
}

你可能感兴趣的:(button)