For my uni work im doing error handling and currnetly trying to do a ArgumentOutOfRangeException. with the code below as the main part. when i run it i get an error saying 'List<int>' does not contain a constructor that takes 3 arguments and i dont know what i need to do to fix it. i am intentionally trying to get the exception.
try
{
List<int> lst = new List<int>( 100, 200, 300 );
Console.WriteLine(lst[3]); // Throws ArgumentOutOfRangeException
Console.ReadLine();
}
catch (ArgumentOutOfRangeException ex)
{
Console.WriteLine("ArgumentOutOfRangeException: " + ex.Message);
}