Is this the best method to get the name of a specific exception in C #:
ex.GetType().ToString()
In the general exception handler:
catch (Exception ex)
ex.GetType().Name or ex.GetType().FullName for the full name.
ex.GetType().Name
ex.GetType().FullName
Try ex.GetType().Name
try { object test = null; test.ToString(); } catch (Exception ex) { Console.WriteLine(ex.GetType().Name); }
Gives it.
NullReferenceException
Source: https://habr.com/ru/post/1013447/More articles:TFSGoogle App Engine requires indexes for tests - pythonSmsManager SendDataMessage on Android - androidCustom Authorized Filter with aspnet core - asp.netMySQL Insert Select does not enforce NULL constraint - mysqlProblem creating valid test case for promise rate limit function - javascriptIs there a difference between a placeholder and a variable when the model is not built? - pythontypescript compiler command (tsc) not working with tsconfig - typescriptOverride existing data annotation attribute in asp.net core 1.1 - c #Image does not load in tag with ftp url - angularjsAll Articles