/// <summary> /// Initializes a new instance of the <see cref="HtmlScriptCollection"/> class /// that contains elements copied from the specified collection and /// that has the same initial capacity as the number of elements copied. /// </summary> /// <param name="collection">The <see cref="HtmlScriptCollection"/> /// whose elements are copied to the new collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList(ICollection)"/> for details.</remarks> public HtmlScriptCollection(HtmlScriptCollection collection) { if (collection == null) throw new ArgumentNullException("collection"); this._array = new HtmlScript[collection.Count]; AddRange(collection); }
internal ReadOnlyList(HtmlScriptCollection collection) : base(Tag.Default) { this._collection = collection; }
internal Enumerator(HtmlScriptCollection collection) { this._collection = collection; this._version = collection._version; this._index = -1; }
/// <overloads> /// Adds a range of elements to the end of the <see cref="HtmlScriptCollection"/>. /// </overloads> /// <summary> /// Adds the elements of another collection to the end of the <see cref="HtmlScriptCollection"/>. /// </summary> /// <param name="collection">The <see cref="HtmlScriptCollection"/> whose elements /// should be added to the end of the current collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <exception cref="NotSupportedException"> /// <para>The <see cref="HtmlScriptCollection"/> is read-only.</para> /// <para>-or-</para> /// <para>The <b>HtmlScriptCollection</b> has a fixed size.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.AddRange"/> for details.</remarks> public virtual void AddRange(HtmlScriptCollection collection) { if (collection == null) throw new ArgumentNullException("collection"); if (collection.Count == 0) return; if (this._count + collection.Count > this._array.Length) EnsureCapacity(this._count + collection.Count); ++this._version; Array.Copy(collection._array, 0, this._array, this._count, collection.Count); this._count += collection.Count; }
/// <summary> /// Creates a shallow copy of the <see cref="HtmlScriptCollection"/>. /// </summary> /// <returns>A shallow copy of the <see cref="HtmlScriptCollection"/>.</returns> /// <remarks>Please refer to <see cref="ArrayList.Clone"/> for details.</remarks> public virtual object Clone() { HtmlScriptCollection collection = new HtmlScriptCollection(this._count); Array.Copy(this._array, 0, collection._array, 0, this._count); collection._count = this._count; collection._version = this._version; return collection; }
/// <summary> /// Returns a synchronized (thread-safe) wrapper /// for the specified <see cref="HtmlScriptCollection"/>. /// </summary> /// <param name="collection">The <see cref="HtmlScriptCollection"/> to synchronize.</param> /// <returns> /// A synchronized (thread-safe) wrapper around <paramref name="collection"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList.Synchronized"/> for details.</remarks> public static HtmlScriptCollection Synchronized(HtmlScriptCollection collection) { if (collection == null) throw new ArgumentNullException("collection"); return new SyncList(collection); }
/// <summary> /// Returns a read-only wrapper for the specified <see cref="HtmlScriptCollection"/>. /// </summary> /// <param name="collection">The <see cref="HtmlScriptCollection"/> to wrap.</param> /// <returns>A read-only wrapper around <paramref name="collection"/>.</returns> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList.ReadOnly"/> for details.</remarks> public static HtmlScriptCollection ReadOnly(HtmlScriptCollection collection) { if (collection == null) throw new ArgumentNullException("collection"); return new ReadOnlyList(collection); }
public override void AddRange(HtmlScriptCollection collection) { lock (this._root) this._collection.AddRange(collection); }
internal SyncList(HtmlScriptCollection collection) : base(Tag.Default) { this._root = collection.SyncRoot; this._collection = collection; }
public override void AddRange(HtmlScriptCollection collection) { throw new NotSupportedException("Read-only collections cannot be modified."); }