Click here to Skip to main content
15,881,715 members
Articles / Programming Languages / C#

CodeDom Assistant

Rate me:
Please Sign up or sign in to vote.
4.84/5 (26 votes)
21 Sep 20074 min read 137.3K   6.6K   82  
Generating CodeDom Code By Parsing C# or VB
using System;
using System.Collections.Generic;
using System.Text;

namespace ScintillaNet
{
	public class Snippet : IComparable<Snippet>
	{
		private const char _realDelimeter = '�';

		public char DefaultDelimeter = '$';

		public Snippet(string shortcut, string code) : this(shortcut, code, '$', false) { }

		public Snippet(string shortcut, string code, char delimeter, bool isSurroundsWith)
		{
			_isSurroundsWith	= isSurroundsWith;
			_shortcut			= shortcut;
			_delimeter			= delimeter;
			Code				= code;			
		}


		private string _realCode;
		internal string RealCode
		{
			get
			{
				return _realCode;
			}
			set
			{
				_realCode = value;
			}
		}

		private string _shortcut;
		public string Shortcut
		{
			get
			{
				return _shortcut;
			}
			set
			{
				_shortcut = value;
			}
		}

		private char _delimeter;
		public char Delimeter
		{
			get
			{
				return _delimeter;
			}
			set
			{
				_delimeter = value;
			}
		}

		private string _code;
		public string Code
		{
			get
			{
				return _code;
			}
			set
			{
				_code = value;
				_realCode = _code.Replace(_delimeter, _realDelimeter);
			}
		}

		private List<string> _languages = new List<string>();
		public List<string> Languages
		{
			get
			{
				return _languages;
			}
			set
			{
				_languages = value;
			}
		}

		private bool _isSurroundsWith;
		public bool IsSurroundsWith
		{
			get
			{
				return _isSurroundsWith;
			}
			set
			{
				_isSurroundsWith = value;
			}
		}

		#region IComparable<Snippet> Members

		public int CompareTo(Snippet other)
		{
			return StringComparer.OrdinalIgnoreCase.Compare(_shortcut, other._shortcut);
		}

		#endregion
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions