Advertisement
Guest User

ads

a guest
Oct 23rd, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Wyjątki
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. int liczba1;
  15. int liczba2 = 30;
  16. int liczba3 = 1;
  17. #region try
  18. try { liczba1 = liczba2 / liczba3; }
  19. #endregion
  20. #region catch
  21. catch (Exception e)
  22. {
  23. Console.WriteLine("Message", e.Message);
  24. }
  25.  
  26. #endregion
  27. #region finally
  28. finally { Console.WriteLine("Finally"); }
  29.  
  30. int[] table = new int[2];
  31. try { table[25] = 2; }
  32. #endregion
  33. catch (IndexOutOfRangeException e)
  34. {
  35. Console.WriteLine("Error 1");
  36. }
  37. catch
  38. {
  39. Console.WriteLine("Error 2");
  40. }
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement