public override void Add(Type elementType) { if (elementType.IsAbstract) { throw new ArgumentException("Must pass a concrete element type.", "elementType"); } if (!typeof(ComponentDataType).IsAssignableFrom(elementType)) { throw new ArgumentException("The element type must belong to the generic type of the list.", "elementType"); } ComponentDataType newElement; if (elementType == typeof(CDTResourceKey)) { newElement = new CDTResourceKey(0, elementHandler, _ParentTGIBlocks); } else if (elementType == typeof(CDTAssetResourceName)) { newElement = new CDTAssetResourceName(0, elementHandler, _ParentTGIBlocks); } else { newElement = Activator.CreateInstance(elementType, new object[] { (int)0, elementHandler, }) as ComponentDataType; } base.Add(newElement); }
public override int CompareTo(ComponentDataType other) { if (this.GetType() != other.GetType()) { return(-1); } CDTResourceKey oth = (CDTResourceKey)other; int res = key.CompareTo(oth.key); if (res != 0) { return(res); } res = controlCode.CompareTo(oth.controlCode); if (res != 0) { return(res); } return(data.CompareTo(oth.data)); }
public CDTResourceKey(int APIversion, EventHandler handler, CDTResourceKey basis, DependentList <TGIBlock> ParentTGIBlocks = null) : this(APIversion, handler, basis.key, basis.controlCode, basis.data, ParentTGIBlocks ?? basis.ParentTGIBlocks) { }