Theme-Logo
  •   .Net
    •   C Sharp(C#)
    •   Web API
    •   Micro Services
    •   ASP.Net
    • ASP.Net MVC
    • .Net Core
  •   Database
    • SQL Server
    • Oracle
    • PostgreSQL
  •   jQuery
    • jQuery Tutorials
    • jQuery Plugins
    • jQuery UI
    • More on jquery
  •   Tutorials
    • Microservices Tutorials
    • DotNet Core Tutorials
    • PostgreSql Tutorials

Why throwing an exceptions are bad idea in C#

What is an Exception?

Exceptions are a type of error that occurs during the execution of an application. Errors are typically problems that are not expected. Whereas, exceptions are expected to happen within the application’s code for various reasons.

An exception is something that does not follow a rule which makes it unexpected.

One case is when you should be throwing a standard exception. For example, if your method takes a file name and is supposed to return a file, you should probably throw your platform's standard FileNotFoundException rather than throw PeanutPowersFileNotFoundException. If you really want to throw your own exception, you should probably have it extend the standard FileNotFoundException.

Donn't throw an exception just handle it.

Why exceptions are a bad idea?

  • Exceptions Should not be an Expected Outcome
  • Exceptions are Expensive
  • Exceptions Hinder Reusability
  • Exceptions May Interfere with Transactions
  • Exceptions Evoke Fear
  • Trending Post
    What are the effects methods used in jQuery?.
    What are the categories in jquery Events?
    What is the difference between the ID selector and class selector in jQuery?
    What is the difference between onload() and document.ready() methods?
    What is the advantage of hosting a jQuery using a CDN?
    What is the difference between bind() vs live() vs delegate() methods in jQuery?
    Explain the difference between jquery.size() and jquery.length?
    Explain the difference between $(this) and this in jQuery?
    Interview Questions and Answers
    What are JQuery selectors?
    What are the different types of Selectors?
    What is jQuery.noConflict?
    About us

    DotNet Palace is a community platform created and maintained by The articles are mainly focused on Microsoft stack technologies like C#, ASP.Net, MVC, .Net Core, SQL Server and Oracle, PostgreSQL, SQLite etc. To improve the site's content you can send your valuable suggestions at info.dotnetpalace@gmail.com

    Quick links
  • SOLID Principles
  • Questions
  • OOPS Principles
  • DotNet Palace Tutorials
  • Privacy Policy
  • Terms and Condition