查看文章
 
对载入AppDomain的程序集的反射
2009-07-30 0:52

///对载入AppDomain的程序集的反射
///

using System;
using System.Reflection;

class wangjun
{
    public static void Main()
    {
        //得到当前正在执行程序集的对象
        Assembly assembly = Assembly.GetExecutingAssembly();
        //从程序集中得到类型,并遍历类型
        foreach (Type type in assembly.GetTypes())
        {
            //输出类型名
            Console.WriteLine("class is {0}",type);
            //从类型中得到方法名,并遍历方法
            foreach (MethodInfo method in type.GetMethods())
            {
                //输出方法名
                Console.WriteLine("method is {0}",method);
                //从方法名中得到签名(方法的参数),并遍历签名
                foreach (ParameterInfo parameter in method.GetParameters())
                {
                    //输出签名
                    Console.WriteLine("parameter is {0}",parameter);
                }
            }
        }
    }
}


类别:c#和.net2.0实战 平台语言与框架||添加到搜藏 |分享到i贴吧|浏览(159)|评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
     

   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu