Table of Contents

Class ExceptionExtensions

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

Extension methods for the Exception class.

public static class ExceptionExtensions
Inheritance
ExceptionExtensions

Methods

Flatten(Exception)

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

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

Parameters

exception Exception

The Exception to extend.

Returns

IEnumerable<Exception>

An empty 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 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 Flatten().

Exceptions

ArgumentNullException

exception is null.