2002-04-27 Rodrigo Moya <rodrigo@ximian.com>
[mono.git] / mcs / class / System.Data / System.Data / DataTableCollection.cs
1 //
2 // System.Data.DataTableCollection.cs
3 //
4 // Author:
5 //   Christopher Podurgiel (cpodurgiel@msn.com)
6 //
7 // (C) Chris Podurgiel
8 //
9
10 using System;
11
12 namespace System.Data
13 {
14         /// <summary>
15         /// Represents the collection of tables for the DataSet.
16         /// </summary>
17         public class DataTableCollection : InternalDataCollectionBase
18         {
19                 private DataTable[] tables = null;
20                 private int size = 0;
21
22                 public virtual DataTable Add () {
23                 }
24                 
25                 public int Count {
26                         get { return size; }
27                 }
28
29                 // IsReadOnly and IsSynchronized must be implemented or
30                 // is it safe to use InternalDataCollectionBase's
31
32                 public DataTable this[int index] {
33                         get {
34                                 if (index < size)
35                                         return tables[index];
36                                 return null;
37                         }
38                 }
39
40                 public DataTable this[string name] {
41                         get {
42                                 for (int i = 0; i < size; i++) {
43                                         if (tables[i].TableName == name)
44                                                 return tables[i];
45                                 }
46
47                                 return null;
48                         }
49                 }
50         }
51 }