Advertisement
Guest User

sklivvz

a guest
Oct 2nd, 2008
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. using System;
  2. class Exceptions
  3. {
  4.  
  5.     static Random rand = new Random();
  6.  
  7.     static void Main(string[] args)
  8.     {
  9.         Exceptions e = new Exceptions();
  10.         Console.WriteLine(DateTime.Now);
  11.         for(int i=0; i<2000000; i++)
  12.             if (e.rc1()==1)
  13.                 Console.WriteLine("rc1()==1");
  14.  
  15.         Console.WriteLine(DateTime.Now);
  16.         for(int i=0; i<2000000; i++)
  17.         {
  18.             try
  19.             {
  20.                 e.e1();
  21.             }
  22.             catch (Exception ex)
  23.             {
  24.                 Console.WriteLine(ex.ToString());
  25.             }
  26.         }
  27.         Console.WriteLine(DateTime.Now);
  28.     }
  29.  
  30.     int rc1()
  31.     {
  32.         if(rc2()==1)
  33.         {
  34.             Console.WriteLine("rc2()==1");
  35.             return 1;
  36.         }
  37.         return 0;
  38.     }
  39.  
  40.     int rc2()
  41.     {
  42.         if(rc3()==1)
  43.         {
  44.             Console.WriteLine("rc3()==1");
  45.             return 1;
  46.         }
  47.         return 0;
  48.     }
  49.     int rc3()
  50.     {
  51.         if(rc4()==1)
  52.         {
  53.             Console.WriteLine("rc4()==1");
  54.             return 1;
  55.         }
  56.         return 0;
  57.     }
  58.     int rc4()
  59.     {
  60.         if(rc5()==1)
  61.         {
  62.             Console.WriteLine("rc5()==1");
  63.             return 1;
  64.         }
  65.         return 0;
  66.     }
  67.     int rc5()
  68.     {
  69.         if(rc6()==1)
  70.         {
  71.             Console.WriteLine("rc6()==1");
  72.             return 1;
  73.         }
  74.         return 0;
  75.     }
  76.     int rc6()
  77.     {
  78.         if(rc7()==1)
  79.         {
  80.             Console.WriteLine("rc7()==1");
  81.             return 1;
  82.         }
  83.         return 0;
  84.     }
  85.     int rc7()
  86.     {
  87.         if(rc8()==1)
  88.         {
  89.             Console.WriteLine("rc8()==1");
  90.             return 1;
  91.         }
  92.         return 0;
  93.     }
  94.     int rc8()
  95.     {
  96.         if(rc9()==1)
  97.         {
  98.             Console.WriteLine("rc9()==1");
  99.             return 1;
  100.         }
  101.         return 0;
  102.     }
  103.     int rc9()
  104.     {
  105.         if(rc10()==1)
  106.         {
  107.             Console.WriteLine("rc10()==1");
  108.             return 1;
  109.         }
  110.         return 0;
  111.     }
  112.     int rc10()
  113.     {
  114.         if(rand.Next() % 100 == 1)
  115.         {
  116.             Console.WriteLine("Error");
  117.             return 1;
  118.         }
  119.         Console.WriteLine("OK");
  120.         return 0;
  121.     }
  122.  
  123.     void e1() { e2(); }
  124.  
  125.     void e2() { e3(); }
  126.  
  127.     void e3() { e4(); }
  128.  
  129.     void e4() { e5(); }
  130.  
  131.     void e5() { e6(); }
  132.  
  133.     void e6() { e7(); }
  134.  
  135.     void e7() { e8(); }
  136.  
  137.     void e8() { e9(); }
  138.  
  139.     void e9() { e10(); }
  140.  
  141.     void e10() {
  142.         if (rand.Next() % 100 == 1)
  143.             throw new Exception("Error");
  144.         Console.WriteLine("OK");
  145.     }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement