天生舞男

我喜欢谦虚的学习各种...,希望自己能坚持一辈子,因为即使一张卫生巾也是有它的作用.
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

Posted on 2005-10-09 14:01  天生舞男  阅读(348)  评论(0编辑  收藏  举报

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();

        }
    }
}