Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Custom Exception Handling "Best Practise"

Custom Exception Handling "Best Practise"

Scheduled Pinned Locked Moved C#
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Spaz80
    wrote on last edited by
    #1

    Hello Im writing an application that will implement its own custom exceptions Just wanted to hear if anyone has any input before I start on how to do this "best practise"?? Cheers Spaz

    C 1 Reply Last reply
    0
    • S Spaz80

      Hello Im writing an application that will implement its own custom exceptions Just wanted to hear if anyone has any input before I start on how to do this "best practise"?? Cheers Spaz

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Derive new classes from existing exceptions. Use ApplicationException as a base, not Exception.

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      R 1 Reply Last reply
      0
      • C Christian Graus

        Derive new classes from existing exceptions. Use ApplicationException as a base, not Exception.

        Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        Christian Graus wrote:

        Use ApplicationException as a base, not Exception.

        Not really. From MSDN's Best Practices for Handling Exceptions[^]: For most applications, derive custom exceptions from the Exception class. It was originally thought that custom exceptions should derive from the ApplicationException class; however in practice this has not been found to add significant value. /ravi

        My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups