Javatpoint Logo
Javatpoint Logo

C# finally

C# finally block is used to execute important code which is to be executed whether exception is handled or not. It must be preceded by catch or try block.

C# finally example if exception is handled


System.DivideByZeroException: Attempted to divide by zero.
Finally block is executed
Rest of the code

C# finally example if exception is not handled


Unhandled Exception: System.DivideBy

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA