get type of exception c#

60

get type of exception c# -

try
{
    // do something here
}
catch(Exception ex)
{
	// will print System.NullReferenceException for example
    Console.WriteLine(ex.GetType().ToString());
}

Comments

Submit
0 Comments