本文整理汇总了C#中Trace.Match方法的典型用法代码示例。如果您正苦于以下问题:C# Trace.Match方法的具体用法?C# Trace.Match怎么用?C# Trace.Match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace.Match方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public int Run()
{
_trace = new Trace("ThrowInCatchTest", "0123456");
_trace.Write("0");
try
{
_trace.Write("1");
try
{
_trace.Write("2");
throw new Exception(".....");
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("3");
throw new Exception("5");
}
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("4");
_trace.Write(e.Message);
}
_trace.Write("6");
return _trace.Match();
}
示例2: Run
public int Run()
{
_trace = new Trace("TryCatchInFinallyTest", "0123456");
_trace.Write("0");
try
{
_trace.Write("1");
}
finally
{
_trace.Write("2");
try
{
_trace.Write("3");
throw new InvalidProgramException();
}
catch(InvalidProgramException e)
{
Console.WriteLine(e);
_trace.Write("4");
}
_trace.Write("5");
}
_trace.Write("6");
return _trace.Match();
}
示例3: Run
public int Run()
{
_trace = new Trace("BaadbaadTest", "1234");
try
{
DoStuff();
}
catch (Exception e)
{
Console.WriteLine(e);
_trace.Write("4");
}
return _trace.Match();
}
示例4: Run
public int Run()
{
_trace = new Trace("RecursiveRethrow", "210C0C1C2RecursionIsFun");
try
{
LoveToRecurse(2);
}
catch (Exception e)
{
Console.WriteLine(e);
_trace.Write(e.Message);
}
return _trace.Match();
}
示例5: Run
public int Run()
{
_trace = new Trace("RecursiveThrowNew", "210C0(eX)C1(e0)C2(e1)CM(e2)");
try
{
LoveToRecurse(2);
}
catch (Exception e)
{
_trace.Write("CM(" + e.Message + ")");
Console.WriteLine(e);
}
return _trace.Match();
}
示例6: Run
public int Run()
{
_trace = new Trace("CollidedUnwindTest", "0123456789ABCDE");
try
{
_trace.Write("0");
Foo();
}
catch (ExType2 e)
{
Console.WriteLine(e);
_trace.Write("E");
}
return _trace.Match();
}
示例7: Run
public int Run()
{
int n = 8;
string expected = "";
// create expected result string
for (int i = n; i >= 0; i--)
{
expected += i.ToString();
}
_trace = new Trace("RecurseTest", expected);
DoTest(n);
return _trace.Match();
}
示例8: Run
public int Run()
{
_trace = new Trace("BaseClassTest", "0121");
try
{
f1();
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("2" + e.Message);
}
return _trace.Match();
}
示例9: Run
public int Run()
{
_trace = new Trace("RethrowAndFinallysTest", "abcdefF3ED2CB1A[done]");
try
{
_trace.Write("a");
try
{
_trace.Write("b");
try
{
_trace.Write("c");
try
{
_trace.Write("d");
try
{
_trace.Write("e");
try
{
_trace.Write("f");
throw new Exception("ex1");
}
finally
{
_trace.Write("F");
}
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("3");
throw;
}
finally
{
_trace.Write("E");
}
}
finally
{
_trace.Write("D");
}
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("2");
throw;
}
finally
{
_trace.Write("C");
}
}
finally
{
_trace.Write("B");
}
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("1");
}
finally
{
_trace.Write("A");
}
_trace.Write("[done]");
return _trace.Match();
}
示例10: Run
public int Run()
{
_trace = new Trace("GoryNativePastTest", "0123456");
_trace.Write("0");
try
{
try
{
foo();
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("4");
throw;
}
}
catch(Exception e)
{
_trace.Write("5");
_trace.Write(e.Message);
}
return _trace.Match();
}
示例11: Run
public int Run()
{
_trace = new Trace("GoryManagedPresentTest", "0123456");
try
{
_trace.Write("0");
foo(1234);
_trace.Write("%%%%");
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("6");
}
return _trace.Match();
}
示例12: Run
public int Run()
{
_trace = new Trace("ThrowInFinallyTest", "0123456789Ca");
_trace.Write("0");
try
{
_trace.Write("1");
Dumb();
}
catch(Exception e)
{
Console.WriteLine(e);
_trace.Write("9");
_trace.Write(e.Message);
}
_trace.Write("a");
return _trace.Match();
}
示例13: Run
//.........这里部分代码省略.........
{
_trace.WriteLine("In four's finally");
}
finishfour:
break;
case "five":
try
{
try
{
try
{
_trace.WriteLine("s == five");
}
finally
{
_trace.WriteLine("Five's finally 0");
}
}
catch (Exception)
{
_trace.WriteLine("Unreached");
}
finally
{
_trace.WriteLine("Five's finally 1");
}
break;
}
finally
{
_trace.WriteLine("Five's finally 2");
}
default:
try
{
_trace.WriteLine("Greater than five");
goto finish;
}
finally
{
_trace.WriteLine("in six's finally");
}
};
continue;
}
finally
{
_trace.WriteLine("In inner finally");
}
}
catch (Exception e)
{
_trace.WriteLine("Caught an exception\r\n");
switch(s[i])
{
case "three":
if (e is System.IndexOutOfRangeException)
{
_trace.WriteLine("Ok\r\n");
i++;
goto beginloop;
}
_trace.WriteLine("Unreached\r\n");
break;
case "four":
if (e is System.IndexOutOfRangeException)
{
_trace.WriteLine("Ok\r\n");
i++;
goto beginloop;
}
_trace.WriteLine("Unreached\r\n");
break;
default:
_trace.WriteLine("****** Unreached");
goto continueloop;
}
}
_trace.WriteLine("Unreached");
}
finally
{
_trace.WriteLine("In outer finally\r\n");
}
continueloop:
_trace.WriteLine("Continuing");
}
finish:
return _trace.Match();;
}