Answers for "get type of exception c#"

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

C# Answers by Framework

Browse Popular Code Answers by Language