Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Exceptions
- {
- static Random rand = new Random();
- static void Main(string[] args)
- {
- Exceptions e = new Exceptions();
- Console.WriteLine(DateTime.Now);
- for(int i=0; i<2000000; i++)
- if (e.rc1()==1)
- Console.WriteLine("rc1()==1");
- Console.WriteLine(DateTime.Now);
- for(int i=0; i<2000000; i++)
- {
- try
- {
- e.e1();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- }
- Console.WriteLine(DateTime.Now);
- }
- int rc1()
- {
- if(rc2()==1)
- {
- Console.WriteLine("rc2()==1");
- return 1;
- }
- return 0;
- }
- int rc2()
- {
- if(rc3()==1)
- {
- Console.WriteLine("rc3()==1");
- return 1;
- }
- return 0;
- }
- int rc3()
- {
- if(rc4()==1)
- {
- Console.WriteLine("rc4()==1");
- return 1;
- }
- return 0;
- }
- int rc4()
- {
- if(rc5()==1)
- {
- Console.WriteLine("rc5()==1");
- return 1;
- }
- return 0;
- }
- int rc5()
- {
- if(rc6()==1)
- {
- Console.WriteLine("rc6()==1");
- return 1;
- }
- return 0;
- }
- int rc6()
- {
- if(rc7()==1)
- {
- Console.WriteLine("rc7()==1");
- return 1;
- }
- return 0;
- }
- int rc7()
- {
- if(rc8()==1)
- {
- Console.WriteLine("rc8()==1");
- return 1;
- }
- return 0;
- }
- int rc8()
- {
- if(rc9()==1)
- {
- Console.WriteLine("rc9()==1");
- return 1;
- }
- return 0;
- }
- int rc9()
- {
- if(rc10()==1)
- {
- Console.WriteLine("rc10()==1");
- return 1;
- }
- return 0;
- }
- int rc10()
- {
- if(rand.Next() % 100 == 1)
- {
- Console.WriteLine("Error");
- return 1;
- }
- Console.WriteLine("OK");
- return 0;
- }
- void e1() { e2(); }
- void e2() { e3(); }
- void e3() { e4(); }
- void e4() { e5(); }
- void e5() { e6(); }
- void e6() { e7(); }
- void e7() { e8(); }
- void e8() { e9(); }
- void e9() { e10(); }
- void e10() {
- if (rand.Next() % 100 == 1)
- throw new Exception("Error");
- Console.WriteLine("OK");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement