Table of Contents

Class ExceptionExtensions

Namespace
Cuemon.Extensions
Assembly
Cuemon.Extensions.Core.dll

Extension methods for the System.Exception class.

public static class ExceptionExtensions
Inheritance
Object
ExceptionExtensions

Methods

Flatten(Exception)

Flattens any inner exceptions from the specified exception into an System.Collections.Generic.IEnumerable<T> sequence of exceptions.

public static IEnumerable<Exception> Flatten(this Exception exception)

Parameters

exception Exception

The System.Exception to extend.

Returns

IEnumerable<Exception>

An empty System.Collections.Generic.IEnumerable<T> sequence if no inner exception(s) was specified; otherwise any inner exception(s) chained to the specified exception.

Remarks

If any inner exceptions are referenced, this method will iterative flatten them all from the specified exception.
Should the exception be of the new System.AggregateException introduced with .NET 4.0, the return sequence of this method will be equal to the result of the InnerExceptions property after a call to System.AggregateException.Flatten.

Exceptions

System.ArgumentNullException

exception is null.