public void Insert(int index, XBase value) { if (value == null || value.GetType() != _ChildItemType) { throw new Exception("类型不正确。请输入类型为" + _ChildItemType.ToString() + "的变量。"); } // Use base class to process actual collection operation _List.Insert(index, value); }
public virtual XBase Add(XBase value) { //if( value == null || TypeHelper.IsXMLObjectType( value.GetType() ) == false ) if (value == null) { throw new ArgumentNullException(); } if (value.GetType() != _ChildItemType) { throw new Exception("类型不正确。请输入类型为" + XObjectHelper.XBaseType.ToString() + "的变量。_ChildItemType=" + _ChildItemType.ToString() + " valueType" + value.GetType().ToString()); } // Use base class to process actual collection operation return(_List.Add(value)); }