CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Interview Success Kit - Get Success in Job Interviews Interview Success Kit - 30,000 Interview Que. & Ans.
Covers 30,000+ Interview Questions asked in actual MNC Interviews - all with model answers.
Get Your Dream Job Now - www.vyoms.com
Sponsored Links
Interview Questions
Our Services

INTERVIEW QUESTIONS MICROSOFT DOTNET DETAILS
Question :
Why is catch(Exception) almost always a bad idea?
Category DotNet Interview Questions
Rating (3.7) By 63 users
Added on 12/21/2010
Views 2033
Rate it!
Answers:

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 asp.net 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

Hi,
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

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

  • 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 Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL DotNet Interview Questions & Answers

    User Options
    Latest 20 Questions
    Give the meaning of the term debt- equity(D:E) ratio.
    What do you mean by financial risk?
    What is business risk?
    State the differences between operating and financial leverage.
    What is combined leverage?
    What is operating leverage?
    What is financial leverage?
    Name the types of leverages.
    What is the master way (table) for calculating the leverages?
    What are the types of tools that can read feeds?
    What is leverage?
    State the external factors affecting capital structure.
    How can I change my blog's name?
    How can I display my entries in full on the home page, without the "Continue reading" link?
    What are the internal factors affecting capital structure?
    How to creates tags automatically?
    Why are some fopen wrappers disabled?
    How to change the name that appears as my entries' signature?
    How to return to the default widgets?
    How to remove a widget?



    Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

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

    Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

    MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
    MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

    GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

    IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
    IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

    SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
    SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |




    Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions



    Cache = 0 Seconds