Skip to content

Instantly share code, notes, and snippets.

@adamstirtan
Created October 24, 2023 15:18
Show Gist options
  • Select an option

  • Save adamstirtan/b477ebe4aeed9f6deefe861ee4be0714 to your computer and use it in GitHub Desktop.

Select an option

Save adamstirtan/b477ebe4aeed9f6deefe861ee4be0714 to your computer and use it in GitHub Desktop.
Fixed design flaws
using System;
class Program
{
static void Main(string[] args)
{
try
{
int[] numbers = new int[5];
int value = numbers[10];
Console.WriteLine("Value: " + value);
}
catch (IndexOutOfRangeException ex)
{
Console.WriteLine("Index out of range: " + ex.Message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment