Skip to content

Commit c0e5500

Browse files
authored
Merge pull request mouredev#7523 from devcherry1/patch-15
#10 - C#
2 parents 91b3b33 + 66ef692 commit c0e5500

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
class Program
3+
{
4+
static void Main()
5+
{
6+
List<string> nombres = new List<string>() { "Anna", "Carlos" };
7+
try
8+
{
9+
Console.WriteLine(nombres[2]);
10+
}
11+
catch (Exception ex)
12+
{
13+
// Manejo genérico para cualquier excepción.
14+
Console.WriteLine($"Ocurrió un error: {ex.Message}");
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)