Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
TIL: C# has a "Catch When" syntax to help you filter exceptions. It already allows you to filter by Exception type, but this is news to me since it allows for finer filtering like:
try
{
//Shit code that will throw an exceptions more than Hillary's tantrums about the elections
}
catch (ExceptionType ex) when (ex.ErrorCode = "0x696666")
{
//Log this fuck up
}
catch (Exception ex)
{
//More logs
}
finally
{
//Run code that doesn't depend on the successful execution of prev code
}
I love C# and use it every single day, but this "When" keyword in Try...Catch...Finally blocks is new to me and will be interesting to start using it now :)
random
c#
less known feature
great language