- World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.

  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!

    Send your Resume to 6000 Companies

    Question :
    Why is catch(Exception) almost always a bad idea?
    Category DotNet Interview Questions
    Rating (0.4) By 1402 users
    Added on 12/21/2005
    Views 3599
    Rate it!

    Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.

    Hi, Catch(System.Exception) is not a bad idea to use. Catch(Exception) means handling all types of errors that are thrown by the Try block. I think even throw Exception is not a bad idea to use in the Catch(Exception)to maintain stack trace.

    Posted by: Pavan    

    Contact Pavan Contact Pavan

    Hi,catch cannot be used whille debuging code as the particular error is thrown and handled by catch.
    but after debuging we should apply catch ..

    Posted by: shanky    

    Contact shanky Contact shanky

    If we use multiple catches(Bcz all the exceptions are came there when the exceptions were found) means it could be a useful thing otherwise i think it is a bad one.

    Posted by: Suresh.K    

    Contact Suresh.K Contact Suresh.K

    Catch(Exception) is used when you are not sure that which exception will be thrown by the code. This syntax will handle all system define exception. But bad side of using this syntax is that it slowdowns the execution speed as CLR have to check each possible exception.

    Posted by: ankur    

    Contact ankur Contact ankur

    catch(Exception) is a bad idea, because, in a code block we know what we written and each code line has its own exception returns, so it should be of those types. Instead of catch(Exception) we can do multiple catch blocks with their exception types.

    Posted by: Nagaraj    

    Contact Nagaraj Contact Nagaraj

    exception affects the execution speed. so maximum try to avoid exception.

    Posted by: selvasundar    

    Contact selvasundar Contact selvasundar

    This Catch(Exception) used by programmers to hide their flaws in programming. Its not a good idea to use Try catch block in project.

    Posted by: Daniyal    

    Contact Daniyal Contact Daniyal

    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

    Related Questions
    View Answer
    What is FullTrust? Do GAC?ed assemblies have FullTrust?
    View Answer
    What are PDBs? Where must they be located for debugging to work?
    View Answer
    What is strong-typing versus weak-typing? Which is preferred? Why?
    View Answer
    What is the difference between thread and process?
    View Answer
    What is the difference between a.Equals(b) and a == b?
    View Answer
    How does the lifecycle of Windows services differ from Standard EXE?
    View Answer
    What is a Windows Service and how does its lifecycle differ from a ?standard? EXE?
    View Answer
    What is CLR?
    View Answer
    Explain the differences between Server-side and Client-side code?
    View Answer
    What type of code (server or client) is found in a Code-Behind class?
    View Answer
    Should validation (did the user enter a real date) occur server-side or client-side? Why?
    View Answer
    What does the EnableViewState Means?
    View Answer
    What is the difference between Servers? Transfer and Response. Redirect? Why would I choose one over the other?
    View Answer
    Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component
    View Answer
    Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
    View Answer
    Can you give an example of what might be best suited to place in the Application Start and Session Start subroutines?
    View Answer
    What are ASP.NET Web Forms? How is this technology different than what is available though ASP (1.0-3.0)?
    View Answer
    How does VB.NET/C# achieve polymorphism?
    View Answer
    How would you implement inheritance using VB.NET/C#?
    View Answer
    Whats an assembly ..?
    View Answer

    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here - Best Freshers & Experienced Jobs Website.

    View ALL DotNet Interview Questions

    User Options
    Sponsored Links

    Copyright ©2003-2015, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

    Cache = 0.078125 Seconds