Click here to Skip to main content
15,891,757 members
Articles / Desktop Programming / Win32

OpenS-CAD, a simple 2D CAD application

Rate me:
Please Sign up or sign in to vote.
4.92/5 (89 votes)
30 Dec 2007CPOL14 min read 339.8K   31.3K   222  
A simple 2D CAD application.
using System;
using System.Collections.Generic;
using System.Text;

namespace CommonTools
{
	public class NameObject<T>
	{
		public string m_name = string.Empty;
		public string Name
		{
			get { return m_name; }
			set { m_name = value; }
		}
		public T m_object;
		public T Object
		{
			get { return m_object; }
			set { m_object = value; }
		}
		public NameObject(string name, T obj)
		{
			Name = name;
			Object = obj;
		}
		public override string ToString()
		{
			return Name;
		}
	}
	public class NameObjectCollection<T> : List<NameObject<T> >
	{
		public void Add(string name, T value)
		{
			Add(new NameObject<T>(name, value));
		}
		public NameObject<T> FindValue(T value)
		{
			foreach(NameObject<T> item in this)
			{
				if (item.Object.Equals(value))
					return item;
			}
			return null;
		}
	}
}

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)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions