12 minpresentation

Try-Catch-Finally

Try-Catch-Finally

0 / 10 completed

Basic Try-Catch

csharp
1try
2{
3 // Code that might throw an exception
4 int result = int.Parse("not a number");
5}
6catch (FormatException ex)
7{
8 // Handle the exception
9 Console.WriteLine($"Error: {ex.Message}");
10}
Step 1 of 10
← → NavigateSpace: Skip / NextEnter: Next