2 // System.Data.InternalDataCollectionBase.cs
6 // DataColumnCollection
8 // DataRelationCollection
9 // DataConstraintCollection
12 // Daniel Morgan <danmorg@sc.rr.com>
13 // Tim Coleman <tim@timcoleman.com>
15 // (C) Copyright 2002 Daniel Morgan
16 // (C) Copyright 2002 Tim Coleman
20 using System.Collections;
21 using System.ComponentModel;
26 /// Base class for System.Data collection classes
27 /// that are used within a DataTable object
28 /// to represent a collection of
29 /// relations, tables, rows, columns, and constraints
32 public class InternalDataCollectionBase : ICollection, IEnumerable
36 // FIXME: keep list protected until mcs/mono is fixed
37 protected ArrayList list = null;
38 private bool readOnly = false;
39 private bool synchronized = false;
45 public InternalDataCollectionBase()
47 list = new ArrayList();
55 /// Gets the total number of elements in a collection.
58 public virtual int Count {
59 get { return list.Count; }
63 /// Gets a value indicating whether the InternalDataCollectionBase is read-only.
66 public bool IsReadOnly {
67 get { return readOnly; }
71 /// Gets a value indicating whether the InternalDataCollectionBase is synchronized.
74 public bool IsSynchronized {
75 get { return synchronized; }
79 /// Gets the items of the collection as a list.
81 protected virtual ArrayList List {
86 /// Gets an object that can be used to synchronize the collection.
89 public object SyncRoot {
101 /// Copies all the elements in the current InternalDataCollectionBase to a one-
102 /// dimensional Array, starting at the specified InternalDataCollectionBase index.
104 public void CopyTo(Array ar, int index)
106 list.CopyTo (ar, index);
111 /// Gets an IEnumerator for the collection.
113 public IEnumerator GetEnumerator()
115 return list.GetEnumerator ();