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


    //使用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);
                }
            }
       

  • 相关阅读:
    P1495 曹冲养猪
    luoguP4281[AHOI2008]紧急集合 / 聚会
    NOIP1997 代数表达式
    luogu P3709大爷的字符串题
    luoguP3912 素数个数
    POJ 1065 Wooden Sticks
    POJ 1063 Flip and Shift
    POJ 1062 昂贵的聘礼
    POJ 1003 Hangover
    POJ 1001 Exponentiation
  • 原文地址:https://www.cnblogs.com/teyond/p/3680371.html
Copyright © 2020-2023  润新知