Saturday, May 22, 2010

Should finally block be placed after all catch blocks in c#.NET?

Yes It should be placed after all catch blocks.





The finally block should include all the code that you


want to execute even in case of Exception of any kind


(e.g Closing connection etc.)

Should finally block be placed after all catch blocks in c#.NET?
if u are talking about try and catch blocks then it is not required.


but in some cases it is required to put the finally block
Reply:From what I understand the language itself doesn't require it, but generally speaking you'll quite often need it, so it's probably good programming practice to include one :)





Rawlyn.


No comments:

Post a Comment