Explicit or implicit exception re-throwing in CSharp?
Based on how often I see this sort of thing in code (including my own when I go back and look at older projects), I don't think people realize there's a difference.
A try/catch block in CSharp allows us to capture the thrown exception. Sometimes developers will perform some logic (like logging or whatever else they want) and then rethrow the exception to let it bubble up.
But you can: - Rethrow the captured exception reference by using the throw keyword followed by the exception variable - Rethrow implicitly by just using the throw keyword on its own
Do you know the difference between these two?
Check out the full video: [ Ссылка ]
#dotnet #dotnetcore #csharp #exceptions
Ещё видео!