zoukankan      html  css  js  c++  java
  • ExceptionExtensions

       public static class ExceptionExtensions
       {
          public static IEnumerable<Exception> GetAllExceptions(this Exception ex)
          {
             Exception currentEx = ex;
             yield return currentEx;
             while (currentEx.InnerException != null)
             {
                currentEx = currentEx.InnerException;
                yield return currentEx;
             }
          }
    
          public static IEnumerable<string> GetAllExceptionAsString(this Exception ex)
          {
             Exception currentEx = ex;
             yield return currentEx.ToString();
             while (currentEx.InnerException != null)
             {
                currentEx = currentEx.InnerException;
                yield return currentEx.ToString();
             }
          }
    
          public static IEnumerable<string> GetAllExceptionMessages(this Exception ex)
          {
             Exception currentEx = ex;
             yield return currentEx.Message;
             while (currentEx.InnerException != null)
             {
                currentEx = currentEx.InnerException;
                yield return currentEx.Message;
             }
          }
       }
  • 相关阅读:
    php流程控制
    php运算符
    php数据类型
    php基础
    谈谈2019年
    聊聊这三年
    第二次作业(源代码)
    个人介绍
    22.python匿名函数详解
    11.python内置模块之json模块
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/3391879.html
Copyright © 2011-2022 走看看