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.

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 64 users
Added on 12/21/2010
Views 2042
Rate it!


Answers:

Source: CoolInterview.com

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.
Source: CoolInterview.com



Source: CoolInterview.com

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.
Source: CoolInterview.com



Posted by: Pavan

Contact Pavan Contact Pavan

Source: CoolInterview.com

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 ..
Source: CoolInterview.com



Posted by: shanky

Contact shanky Contact shanky

Source: CoolInterview.com

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.
Source: CoolInterview.com



Posted by: Suresh.K

Contact Suresh.K Contact Suresh.K

Source: CoolInterview.com

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.
Source: CoolInterview.com



Posted by: ankur

Contact ankur Contact ankur

Source: CoolInterview.com

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.
Source: CoolInterview.com



Posted by: Nagaraj

Contact Nagaraj Contact Nagaraj

Source: CoolInterview.com

exception affects the execution speed. so maximum try to avoid exception.
Source: CoolInterview.com



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
    India News Network

    Latest 20 Questions
    State the losses from which Insurance Claims can be made?
    What is the meaning of Insurance Claims?
    If owner's equity of a business are Rs.90,000 and profits are of Rs. 60,000 for the year calculate total assets of the business:- a) Rs. 1,50,000 b) Rs. 1,20,000 c) Rs. 30,000 d) Rs. 1,70,000
    What is Yield to Maturity in Futures and Options Trading Market?
    What is Yield Curve in Futures and Options Trading Market?
    Who is a Writer in Futures and Options Trading Market?
    What is Wire House in Futures and Options Trading Market?
    What is Warehouse Receipt in Futures and Options Trading Market?
    What is Vertical Spread in Futures and Options Trading Market?
    What is Variable Limit in Futures and Options Trading Market?
    What is Underlying Security in Futures and Options Trading Market?
    What is Underlying Futures Contract in Futures and Options Trading Market?
    What is Uncovered put writing in Futures and Options Trading Market?
    What is Uncovered call writing in Futures and Options Trading Market?
    What is U.S. Treasury Note in Futures and Options Trading Market?
    What is U.S. Treasury Bond in Futures and Options Trading Market?
    What is U.S. Treasury Bill in Futures and Options Trading Market?
    What is Type in Futures and Options Trading Market?
    What is Trade Balance in Futures and Options Trading Market?
    What is Time-Stamp in Futures and Options Trading Market?



    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.00293 Seconds