本文整理汇总了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());
}