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 private ArrayList list = null;
37 private bool readOnly = false;
38 private bool synchronized = false;
44 public InternalDataCollectionBase()
46 list = new ArrayList();
54 /// Gets the total number of elements in a collection.
57 public virtual int Count {
58 get { return list.Count; }
62 /// Gets a value indicating whether the InternalDataCollectionBase is read-only.
65 public bool IsReadOnly {
66 get { return readOnly; }
70 /// Gets a value indicating whether the InternalDataCollectionBase is synchronized.
73 public bool IsSynchronized {
74 get { return synchronized; }
78 /// Gets the items of the collection as a list.
80 protected virtual ArrayList List {
85 /// Gets an object that can be used to synchronize the collection.
88 public object SyncRoot {
100 /// Copies all the elements in the current InternalDataCollectionBase to a one-
101 /// dimensional Array, starting at the specified InternalDataCollectionBase index.
103 public void CopyTo(Array ar, int index)
105 list.CopyTo (ar, index);
110 /// Gets an IEnumerator for the collection.
112 public IEnumerator GetEnumerator()
114 return list.GetEnumerator ();