using System;
class Program
{
static void Main()
{
int[] ar = { 1, 2, 3 };
try
{
if (ar.Length > 2)
{
throw new Exception("Array size Exceeds");
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.ReadKey();
}
}
|
Class Program
Private Shared Sub Main()
Dim ar As Integer() = {1, 2, 3}
Try
If ar.Length > 2 Then
Throw New Exception("Array size Exceeds")
End If
Catch e As Exception
Console.WriteLine(e.Message)
End Try
Console.ReadKey()
End Sub
End Class
|