本文整理匯總了C#中System.Exception.First方法的典型用法代碼示例。如果您正苦於以下問題:C# Exception.First方法的具體用法?C# Exception.First怎麽用?C# Exception.First使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Exception
的用法示例。
在下文中一共展示了Exception.First方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CaseFailed
public void CaseFailed(string @case, Exception[] exceptions)
{
using (Foreground.Red)
Console.WriteLine("Test '{0}' failed: {1}", @case, exceptions.First().GetType().FullName);
Console.Out.WriteCompoundStackTrace(exceptions);
Console.WriteLine();
Console.WriteLine();
}
示例2: CaseFailed
public void CaseFailed(string @case, Exception[] exceptions)
{
tdnet.TestFinished(new TestResult
{
Name = @case,
State = TestState.Failed,
Message = exceptions.First().GetType().FullName,
StackTrace = CompoundStackTrace(exceptions),
});
}
示例3: CaseFailed
public void CaseFailed(Case @case, Exception[] exceptions)
{
var entry = new StringBuilder();
var primary = exceptions.First();
entry.Append(string.Format("{0} failed: {1}", @case.Name, primary.Message));
foreach (var exception in exceptions.Skip(1))
{
entry.AppendLine();
entry.Append(string.Format(" Secondary Failure: {0}", exception.Message));
}
log.Add(entry.ToString());
}