00f464349ef4ce003a4c018f6a067cec755e323b
[mono.git] / mcs / class / referencesource / System.Data / System / Data / Odbc / OdbcErrorCollection.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="OdbcErrorCollection.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">Microsoft</owner>
6 // <owner current="true" primary="false">Microsoft</owner>
7 //------------------------------------------------------------------------------
8
9 namespace System.Data.Odbc {
10
11     using System;
12     using System.Collections;
13     using System.Data;
14
15     [Serializable]
16     public sealed class OdbcErrorCollection : ICollection {
17         private ArrayList _items = new ArrayList();
18
19         internal OdbcErrorCollection() {
20         }
21
22         Object System.Collections.ICollection.SyncRoot {
23             get { return this; }
24         }
25
26         bool System.Collections.ICollection.IsSynchronized {
27             get { return false; }
28         }
29
30         public int Count {
31             get {
32                 return _items.Count;
33             }
34         }
35
36         public OdbcError this[int i] {
37             get {
38                 return (OdbcError)_items[i];
39             }
40         }
41
42         internal void Add(OdbcError error) {
43             _items.Add(error);
44         }
45
46         public void CopyTo (Array array, int i) {
47             _items.CopyTo(array, i);
48         }
49
50         public void CopyTo (OdbcError[] array, int i) {
51             _items.CopyTo(array, i);
52         }
53
54         public IEnumerator GetEnumerator() {
55             return _items.GetEnumerator();
56         }
57
58         internal void SetSource (string Source) {
59             foreach (object error in _items) {
60                 ((OdbcError)error).SetSource(Source);
61             }
62         }
63     }
64 }