Custom Exception that processes Message

Posted on: Thu Feb 18 16:06:22 -0800 2010. Updated on: Thu Feb 18 16:07:06 -0800 2010.
Category: DotNet

Here is a basic example of a custom exception that can have the message property assigned to.

public class PresentationException : Exception, ISerializable
	{
		public override string Message
		{
			get
			{
				return _message;
			}
		}
		private string _message;

		public PresentationException()
		{

		}
		public PresentationException(string message)
		{
			_message = message;
		}
		public PresentationException(string message, Exception inner)
		{
			_message = message;
		}

		// This constructor is needed for serialization.
		protected PresentationException(SerializationInfo info, StreamingContext context)
		{
		}
	}

Comments:

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.