Get Most Inner Exception : Exception Stack « Language Basics « C# / C Sharp
- C# / C Sharp
- Language Basics
- Exception Stack
Get Most Inner Exception
//The MIT License (MIT)
//http://arolibraries.codeplex.com/license
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AroLibraries.ExtensionMethods
{
public static class ExceptionExt
{
public static Exception Ext_GetMostInner(this Exception ex)
{
Exception ActualInnerEx = ex;
while (ActualInnerEx != null)
{
ActualInnerEx = ActualInnerEx.InnerException;
if (ActualInnerEx != null)
ex = ActualInnerEx;
}
return ex;
}
}
}
Related examples in the same category