वहाँ किसी भी तरह से LINQ शैली "शॉर्ट हैंड" कोड लिखने के लिए है। मैं एक्सटेंशन फ़ंक्शन को कॉल करने के बजाय इसे जगह में लिखना पसंद करूंगा (नीचे) या Exception
कक्षा को विरासत में लेना ।
static class Extensions
{
public static string GetaAllMessages(this Exception exp)
{
string message = string.Empty;
Exception innerException = exp;
do
{
message = message + (string.IsNullOrEmpty(innerException.Message) ? string.Empty : innerException.Message);
innerException = innerException.InnerException;
}
while (innerException != null);
return message;
}
};