Throw Argument Out Of Range Exception : Buildin Exceptions « Development Class « C# / C Sharp






Throw Argument Out Of Range Exception

 

using System;
using System.Collections;

class Class1 {
   static void Main(string[] args) {
    try {
      // Display the first 200 chars from the connection string
      Console.WriteLine("asdf".Substring(1, 200));
    }
    catch (Exception objE) {
      Console.WriteLine(objE.ToString());
    }
   }
}

           
         
  








Related examples in the same category

1.Throw and Catch an IO exception because the file zxcvb.data doesn't exist
2.OutOfMemoryException Exception
3.StackOverflowException Exception
4.NullReferenceException Exception
5.InvalidCastException Exception
6.IndexOutOfRangeException Exception
7.OverflowException Exception
8.Throw Index Out Of Range Exception
9.Throw Null reference Exception
10.Throw Invalid Operation Exception
11.Argument Null Exception
12.ArgumentException is thrown when one of the arguments provided to a method is not valid.
13.OverflowException