/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IOclExpression memberCasted = item.As <IOclExpression>(); if ((memberCasted != null)) { this._parent.Member.Add(memberCasted); } if ((this._parent.ReferredCollectionType == null)) { ICollectionType referredCollectionTypeCasted = item.As <ICollectionType>(); if ((referredCollectionTypeCasted != null)) { this._parent.ReferredCollectionType = referredCollectionTypeCasted; return; } } if ((this._parent.Rest == null)) { IVariable restCasted = item.As <IVariable>(); if ((restCasted != null)) { this._parent.Rest = restCasted; return; } } }
/// <summary> /// Initializes a new instance of the <see cref="CollectionValueType"/> class. /// </summary> /// <param name="collectionType">Type of the collection.</param> /// <param name="elementValueType">Type of the element value.</param> public CollectionValueType(ICollectionType collectionType, ValueTypeBase elementValueType) : base(collectionType.GetCollectionType(elementValueType.Type)) { if (collectionType == null) throw new ArgumentNullException("collectionType"); if (elementValueType == null) throw new ArgumentNullException("elementValueType"); this.CollectionType = collectionType; this.ElementValueType = elementValueType; }
public static void AddRange <T>(this ICollectionType <T> basef, IEnumerable <T> items) { basef.InnerList.AddRange(items); }
public static void Add <T>(this ICollectionType <T> basef, T item) { basef.InnerList.Add(item); }