| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- //
- // System.CodeDom CodeAttributeArgumentCollection Class implementation
- //
- // Author:
- // Miguel de Icaza ([email protected])
- //
- // (C) 2001 Ximian, Inc.
- //
- namespace System.CodeDom {
- using System.Collections;
-
- [Serializable]
- public class CodeAttributeArgumentCollection : IList, ICollection, IEnumerable {
- ArrayList attributeArgs;
-
- //
- // Constructors
- //
- public CodeAttributeArgumentCollection ()
- {
- attributeArgs = new ArrayList ();
- }
- //
- // Properties
- //
- public int Count {
- get {
- return attributeArgs.Count;
- }
- }
- public bool IsFixedSize {
- get {
- return true;
- }
- }
- //
- // Methods
- //
- public void Add (CodeAttributeArgument value)
- {
- attributeArgs.Add (value);
- }
- public void AddRange (CodeAttributeArgument [] values)
- {
- foreach (CodeAttributeArgument ca in values)
- attributeArgs.Add (ca);
- }
- public void Clear ()
- {
- attributeArgs.Clear ();
- }
- private class Enumerator : IEnumerator {
- private CodeAttributeArgumentCollection collection;
- private int currentIndex = -1;
- internal Enumerator (CodeAttributeArgumentCollection collection)
- {
- this.collection = collection;
- }
- public object Current {
- get {
- if (currentIndex == collection.Count)
- throw new InvalidOperationException ();
- return collection [currentIndex];
- }
- }
- public bool MoveNext ()
- {
- if (currentIndex > collection.Count)
- throw new InvalidOperationException ();
- return ++currentIndex < collection.Count;
- }
- public void Reset ()
- {
- currentIndex = -1;
- }
- }
-
- public IEnumerator GetEnumerator ()
- {
- return new CodeAttributeArgumentCollection.Enumerator (this);
- }
- //
- // IList method implementations
- //
- public int Add (object value)
- {
- return attributeArgs.Add (value);
- }
- public bool Contains (Object value)
- {
- return attributeArgs.Contains (value);
- }
- public int IndexOf (Object value)
- {
- return attributeArgs.IndexOf (value);
- }
- public void Insert (int index, Object value)
- {
- attributeArgs [index] = value;
- }
- public object this[int index] {
- get {
- return attributeArgs [index];
- }
- set {
- attributeArgs [index] = value;
- }
- }
- public void Remove (object value)
- {
- attributeArgs.Remove (value);
- }
- public void RemoveAt (int index)
- {
- attributeArgs.RemoveAt (index);
- }
- //
- // ICollection method implementations
- //
- public void CopyTo (Array array, int index)
- {
- attributeArgs.CopyTo (array, index);
- }
- public object SyncRoot {
- get {
- return attributeArgs.SyncRoot;
- }
- }
- public bool IsReadOnly {
- get {
- return false;
- }
- }
- public bool IsSynchronized {
- get {
- return attributeArgs.IsSynchronized;
- }
- }
- }
- }
|