Explain Exception Handling in C# with examples????
Poonam Jain
Hi Poonam
The .NET Framework has enhanced the ways in which you deal with errors. C#'s mechanism for handling error conditions allows you to provide custom handling for each type of error condition as well as to separate code that identifies errors from the code that handles them.
http://www.dotnetheaven.com/UploadFile/prathore/ExceptionHandling04062009014816AM/ExceptionHandling.aspx?ArticleID=b7c55086-007c-4119-b05f-5c6e8435af03
public class A{public void Div(){int a= 1,b=0,c;try{ c= a/b;Console.Writeline("c={0}",c)}catch( exception ex){Console.Writeline("Divide by zero exception ");}finally{Release memory--;}
}}Here :try block is through the error that can be catched the catch block and excute program.try block as followe any one of cathed of finally.