1 //------------------------------------------------------------------------------
2 // <copyright file="OleDbErrorCollection.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">Microsoft</owner>
6 // <owner current="true" primary="false">Microsoft</owner>
7 //------------------------------------------------------------------------------
9 namespace System.Data.OleDb {
12 using System.ComponentModel;
13 using System.Collections;
14 using System.Data.Common;
16 [Serializable, ListBindable(false)]
17 public sealed class OleDbErrorCollection : System.Collections.ICollection {
18 readonly private ArrayList items; // WebData 106655
20 internal OleDbErrorCollection(UnsafeNativeMethods.IErrorInfo errorInfo) {
21 ArrayList items = new ArrayList();
23 Bid.Trace("<oledb.IUnknown.QueryInterface|API|OS> IErrorRecords\n");
24 UnsafeNativeMethods.IErrorRecords errorRecords = (errorInfo as UnsafeNativeMethods.IErrorRecords);
25 if (null != errorRecords) {
27 int recordCount = errorRecords.GetRecordCount();
28 Bid.Trace("<oledb.IErrorRecords.GetRecordCount|API|OS|RET> RecordCount=%d\n", recordCount);
30 for (int i = 0; i < recordCount; ++i) {
31 OleDbError error = new OleDbError(errorRecords, i);
38 bool System.Collections.ICollection.IsSynchronized {
42 object System.Collections.ICollection.SyncRoot {
48 ArrayList items = this.items;
49 return ((null != items) ? items.Count : 0);
53 public OleDbError this[int index] {
55 return (this.items[index] as OleDbError);
59 internal void AddRange(ICollection c) {
63 public void CopyTo(Array array, int index) {
64 this.items.CopyTo(array, index);
67 public void CopyTo (OleDbError[] array, int index) {
68 this.items.CopyTo(array, index);
71 public IEnumerator GetEnumerator() {
72 return this.items.GetEnumerator();