当前位置: 首页>>代码示例>>C#>>正文


C# Trace.Match方法代码示例

本文整理汇总了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();
 }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:28,代码来源:throwincatch.cs

示例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();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:28,代码来源:trycatchinfinally.cs

示例3: Run

	public int Run()
	{
		_trace = new Trace("BaadbaadTest", "1234");
		try
		{
			DoStuff();
		}
		catch (Exception e)
		{
			Console.WriteLine(e);
			_trace.Write("4");
		}
		return _trace.Match();
	}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:14,代码来源:Baadbaad.cs

示例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();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:16,代码来源:RecursiveRethrow.cs

示例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();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:16,代码来源:RecursiveThrowNew.cs

示例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();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:17,代码来源:CollidedUnwind.cs

示例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();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:17,代码来源:Recurse.cs

示例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();
  }
开发者ID:l1183479157,项目名称:coreclr,代码行数:16,代码来源:baseclass.cs

示例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();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:74,代码来源:rethrowandfinally.cs

示例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();
 }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:25,代码来源:GoryNativePast.cs

示例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();
    }
开发者ID:rendle-labs,项目名称:coreclr,代码行数:17,代码来源:EHPatternTests.cs

示例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();
 }
开发者ID:l1183479157,项目名称:coreclr,代码行数:19,代码来源:throwinfinally.cs

示例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();;
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:101,代码来源:StrSwitchFinally.cs


注:本文中的Trace.Match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。