Sponsored Links

Interview Questions
Recommended Books

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 2061
Rate it!

Highly Recommended, Hand Picked DotNet Books

Question :

Why is catch(Exception) almost always a bad idea?


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

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

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

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

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

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

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
What are the Hadoop related Projects at Apache?
What are the modules included in Apache Hadoop Project?
What is Apache Hadoop?
What is a Private Cloud? Do we need one to handle Big Data?
How Can We Cope with the Impact of Big Data?
What skills do Big Data analysts need to have?
What does a Big Data analyst do?
What are some real-world examples of Big Data and how it is used?
What is Big Data Analytics?
Why Big Data is becoming so important?
What is the impact of Big Data on Sports Industry?
What is the impact of Big Data on Real estate Industry?
What is the impact of Big Data on Retail Banking Industry?
What is the impact of Big Data on Retail Industry?
What is the impact of Big Data on Technology Industry?
What is the impact of Big Data on Information Technology Industry?
What is the impact of Big Data on Internet of Things (IoT) Industry?
What is the impact of Big Data on Media Industry?
What is the impact of Big Data on Education Industry?
What is the impact of Big Data on Healthcare Industry?

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