System.AggregateException.GetBaseException C# (CSharp) Method

GetBaseException() public method

public GetBaseException ( ) : Exception
return Exception
        public override Exception GetBaseException()
        {
            if (innerExceptions == null || innerExceptions.Count == 0)
                return this;
            return innerExceptions[0].GetBaseException ();
        }

Usage Example

        internal static XElement Meta(AggregateException exception, string eventName)
        {
            var meta = new XElement("Meta",
                new XElement("Component", "Lokad.Cloud.Provisioning"),
                new XElement("Event", eventName));

            if (exception != null)
            {
                var ex = exception.GetBaseException();
                meta.Add(new XElement("Exception",
                    new XAttribute("typeName", ex.GetType().FullName),
                    new XAttribute("message", ex.Message),
                    ex.ToString()));
            }

            return meta;
        }
All Usage Examples Of System.AggregateException::GetBaseException