Click here to Skip to main content
15,879,490 members
Articles / General Programming / String

Enhanced String Handling

Rate me:
Please Sign up or sign in to vote.
4.78/5 (16 votes)
16 Dec 2010CPOL28 min read 45.1K   338   38  
Allow for constructs within a string to be programmatically evaluated for a final string value
using System;


namespace EnhancedStringEvaluate
{
	/// <summary>
	/// Provide an exception that is specific to this library
	/// </summary>
	public class EnhancedStringException : Exception
	{
		/// <summary>May be null or string.Empty</summary>
		public string Identifier { get; private set; }

		/// <summary>May be null</summary>
		public EnhancedStrPairElement Element { get; private set; }

		/// <summary>
		/// .ctor
		/// </summary>
		/// <param name="key"></param>
		/// <param name="elem"></param>
		public EnhancedStringException(string key, EnhancedStrPairElement elem)
			: base()
		{
			Element = elem;
			Identifier = key;
		}

		public EnhancedStringException(string key, EnhancedStrPairElement elem, string message)
			: base(message)
		{
			Element = elem;
			Identifier = key;
		}

		public EnhancedStringException(string key, EnhancedStrPairElement elem, string message, Exception innerException)
			: base(message, innerException)
		{
			Element = elem;
			Identifier = key;
		}

		public EnhancedStringException(string key, string value)
			: this(key, new EnhancedStrPairElement(key, value)) { }

		public EnhancedStringException(string key, string value, string message)
			: this(key, new EnhancedStrPairElement(key, value), message) { }

		public EnhancedStringException(string key, string value, string message, Exception innerException)
			: this(key, new EnhancedStrPairElement(key, value), message, innerException) { }
	}
}

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
United States United States
avifarah@gmail.com

Comments and Discussions