6-masala System namespace uchun quyidagi kod mavjud.
Class MyExc : ApplicationException
{ public MyException1() : base("Exception-1") { }
public override string ToString() { return "Иссклеклекие-3"; }
ommaviy statik int usuli()
{ int s = 22;
sinab ko'ring { s = s / (s - 22); }
catch (DivideByZeroException)
{ Console.Write("Istisno-2. "); yangi MyExc tashlang (); }
qaytarish s;
} }
sinf imtihoni
{ ommaviy statik bo'shliq Main()
{ int s=0;
sinab ko'ring { s = MyExc.Method(); }
catch (MyExc ex) { Console.Write(ex); }
Konsol.WriteLine(" s=" + s);
} }
Kompilyatsiya qilish va ishga tushirish uchun dasturni ishga tushirishga uringandan so'ng konsolga chiqish natijasini ko'rsating: