public void CopyTo(DObject obj) { if (!DType.IsParentOf(obj.DType)) { throw new Exception(string.Format("Type {0} is not a parent of type {1} and so cannot be extended", DType, obj.DType)); } Array.Copy(Fields, obj.Fields, Fields.Length); }
public DVar[] Fields = new DVar[12]; //This is explicityly left unprotected to reduce access overhead public DType SetType(DType type) { if (!DType.IsParentOf(type)) { throw new Exception(string.Format("Type {0} is not a parent of tyoe {1} and so cannot be extended", DType, type)); } DType = type; var maxFieldIndex = DType.FieldIndex; if (maxFieldIndex >= Fields.Length) { var newFields = new DVar[Fields.Length + 10]; Array.Copy(Fields, newFields, Fields.Length); Fields = newFields; } return(type); }