首页 > 其他 > 详细

使用反射,查找WCF异常类型

时间:2014-04-23 22:00:56      阅读:611      评论:0      收藏:0      [点我收藏+]

//使用System.Reflection,查找System.ServiceModel的异常类型
        public void ConsoleException()
        {
            try
            {
                Assembly asm = Assembly.GetExecutingAssembly();
                foreach (AssemblyName item in asm.GetReferencedAssemblies())
                {
                    if (item.Name != "System.ServiceModel") continue;
                    foreach (Type t in Assembly.Load(item).GetTypes())
                    {
                        if (t.Name.EndsWith("Exception"))
                        {
                            Console.WriteLine(t.Name);
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine( ex.Message);
            }
        }
   

使用反射,查找WCF异常类型,布布扣,bubuko.com

使用反射,查找WCF异常类型

原文:http://www.cnblogs.com/teyond/p/3680371.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!