Library tutorials & articles

Exception Handling In C#

Introduction

Definition: "Exception is a runtime error which arises because of abnormal conditions in a code sequence". In C# Exception is a class in the system namespace. An object of an exception is that describe the exceptional conditions occur in a code That means, we are catching an exception, creating an object of it, and then throwing it. C# supports exceptions in a very much the same way as Java and C++.

Before going into detail, I must say the usefulness of knowing and performing exception handling :

  • They cannot be ignored, as if calling code does not handle the error, it causes program termination.
  • They do not need to be to be handled at the point where error took place. This makes them very suitable for library or system code, which can signal an error and leave us to handle it
  • They can be used when passing back a return value cannot be used.

Comments

  1. 27 Nov 2005 at 13:17

    Quote:
    [1]Posted by syedhara on 6 Aug 2002 05:03 PM[/1]
    This article has errors at the please don't publish articles with errors.
    Thanks
    Sri


    reinstall both os and software..and add urself in degbugger group

  2. 27 Nov 2005 at 13:16

    vxy

  3. 27 Nov 2005 at 13:16

    hi reinstall windows and remove and install .net and add urself in debugger gruops.

  4. 06 Aug 2002 at 17:03

    This article has errors at the please don't publish articles with errors.
    Thanks
    Sri

  5. 01 Jan 1999 at 00:00

    This thread is for discussions of Exception Handling In C#.

Leave a comment

Sign in or Join us (it's free).

AddThis

Related podcasts

  • Looking into the C# Crystal Ball with Charlie Calvert and Bill Wagner

    One of the most exciting announcements from PDC was the news about C# 4.0 and Visual Studio 2010. With all the excitement and discussion throughout the event about these new developer tools, we reached out to two experts in the fields. Charlie Calvert and Bill Wagner sat down with Keith and Woody...

Events coming up

  • Dec 6

    Developing AJAX Web Applications with Castle Monorail

    London, United Kingdom

    Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!