Mega Code Archive

 
Categories / C# / Development Class
 

Throw Null reference Exception

using System; using System.Collections; class Class1 {    static void Main(string[] args) {     Exception objException = new Exception();     try {       objException = null;       Console.WriteLine(objException.Message);     } catch (Exception objE) {       Console.WriteLine(objE.ToString());     }    } }