Click here to Skip to main content
15,891,136 members
Articles / Programming Languages / C#

Buffer with overwrite protection and memory allocation on demand

Rate me:
Please Sign up or sign in to vote.
4.57/5 (7 votes)
10 Mar 2008CPOL7 min read 28.2K   244   22  
Implementation of a large memory buffer, with memory allocation on demand and overwrite protection.
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace Buffers
{
	/// <summary>
	/// The exception that is thrown when an attempt to write a readonly bit has been done
	/// </summary>
	[Serializable]
	public class WriteOverlappingException : ApplicationException
	{
		/// <summary>
		/// Default constructor
		/// </summary>
		public WriteOverlappingException()
			: base()
		{
			
		}

		/// <summary>
		/// Constructor that initializes a custom message
		/// </summary>
		/// <param name="message">The message that explains the reason for the exception</param>
		public WriteOverlappingException(string message)
			: base(message)
		{
		}

		/// <summary>
		/// Constructor for wrapping an inner exception
		/// </summary>
		/// <param name="message">The message that explains the reason for the exception</param>
		/// <param name="inner">Inner exception</param>
		public WriteOverlappingException(string message, Exception inner)
			: base(message, inner)
		{
		}

		/// <summary>
		/// Constructor used to deserialize the exception
		/// </summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected WriteOverlappingException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) DGT Experts
Spain Spain
I finished my Degree in Industrial Electronics in the year 2000. I worked for 6 years as a Hardware and Software development engineer in Barcelona. On January 2007 I moved to Dublin to work as Software Engineer and I specialised in .NET technologies. Currently I'm consulting for other companies and running my own start up project Trainer Inside (www.trainerinside.com)

Comments and Discussions