Answers for "c# how to check type of exception"

C#
2

get type of exception c#

try
{
    // do something here
}
catch(Exception ex)
{
	// will print System.NullReferenceException for example
    Console.WriteLine(ex.GetType().ToString());
}
Posted by: Guest on July-01-2021

Code answers related to "c# how to check type of exception"

C# Answers by Framework

Browse Popular Code Answers by Language