answersLogoWhite

0

What is exeption in c sharp?

User Avatar

Anonymous

14y ago
Updated: 8/19/2019

an exception is an error.

it is usual to use exception handlers in your program to guard against crashes

for example

try

{

DatabaseConnection.Open();

}

catch(Exception ex)

{

MessageBox.Show(ex.Message);

}

finally

{

DatabaseConnection.Close();

}

This attempts to open a connection and if there is an error it shows a message box with the pre defined message for that exception. then it cleans up by closing the connection if any part was opened. this stops the program from crashing all the time.

User Avatar

Wiki User

14y ago

What else can I help you with?