try (2,244)


c# - Unhandled Exception Handler in.NET 1.1

c# - Unhandled Exception Handler in.NET 1.1

I'm maintaining a.NET 1.1 application, and one of the things I've been tasked with is making sure the user doesn't see any unfriendly error notifications. I've added handlers to Application.ThreadEx…


.net - Performance Considerations for throwing Exceptions

I have come across the following type of code many a times, and I wonder if this is a good practice(from Performance perspective) or not: try{...// some code}catch(Exception ex){...…


Exception handling: Contract vs Exceptional approach

I know two approaches to Exception handling, lets have a look at them. Contract approach. When a method does not do what it says it will do in the method header, it will throw an exception. Thus the…


What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries?

What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­…


c# - Compact Framework-how do I dynamically create type with no default constructor?

I'm using the.NET CF 3.5. The type I want to create does not have a default constructor so I want to pass a string to an overloaded constructor. How do I do this? Code: Assembly a=Assembly.LoadFro…


c# - Why is.NET exception not caught by try/catch block?

I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it th…


Returning from a finally block in Java

I was surprised recently to find that it's possible to have a return statement in a finally block in Java. It seems like lots of people think it's a bad thing to do as described in 'Don't return in a…


.net - What is the point of the finally block?

Syntax aside, what is the difference between try{} catch(){} finally{x=3;}and try{} catch(){} x=3; edit: in.NET 2.0? so try{throw something maybe x=3}catch(...…


What is the real overhead of try/catch in C#?

So, I know that try/catch does add some overhead and therefore isn't a good way of controlling process flow, but where does this overhead come from and what is it's actual impact?…


Should I derive custom exceptions from Exception or ApplicationException in.NET?

What is best practice when creating your exception classes in a.NET solution: To derive from System.Exception or from System.ApplicationException?…





catch exception error handling throw java example best practices exceptions