using System; using System.Collections.Generic; using System.Text; namespace OpenRa { public class TypeDictionary { Dictionary inner = new Dictionary(); public void Add( T val ) { inner.Add( typeof( T ), val ); } public void Remove() { inner.Remove( typeof( T ) ); } public bool Contains() { return inner.ContainsKey( typeof( T ) ); } public T Get() { return (T)inner[ typeof( T ) ]; } public IEnumerable WithInterface() { foreach( var i in inner ) if( i.Value is T ) yield return (T)i.Value; } } }