2 * Firebird ADO.NET Data provider for .NET and Mono
4 * The contents of this file are subject to the Initial
5 * Developer's Public License Version 1.0 (the "License");
6 * you may not use this file except in compliance with the
7 * License. You may obtain a copy of the License at
8 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
10 * Software distributed under the License is distributed on
11 * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
12 * express or implied. See the License for the specific
13 * language governing rights and limitations under the License.
15 * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16 * All Rights Reserved.
20 using System.Collections;
21 using System.ComponentModel;
23 using FirebirdSql.Data.Common;
25 namespace FirebirdSql.Data.Firebird
27 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/overview/*'/>
29 [Serializable, ListBindable(false)]
31 public sealed class FbErrorCollection : ICollection, IEnumerable
35 private ArrayList errors;
41 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/indexer[@name="Item(System.Int32)"]/*'/>
42 public FbError this[int index]
44 get { return (FbError)this.errors[index]; }
51 internal FbErrorCollection()
53 this.errors = ArrayList.Synchronized(new ArrayList());
58 #region ICollection Properties
60 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/property[@name="Count"]/*'/>
63 get { return this.errors.Count; }
66 bool ICollection.IsSynchronized
68 get { return this.errors.IsSynchronized; }
71 object ICollection.SyncRoot
73 get { return this.errors.SyncRoot; }
78 #region ICollection Methods
80 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/method[@name="CopyTo(System.Array,System.Int32)"]/*'/>
81 public void CopyTo(Array array, int index)
83 this.errors.CopyTo(array, index);
88 #region IEnumerable Methods
90 IEnumerator IEnumerable.GetEnumerator()
92 return this.errors.GetEnumerator();
97 #region Internal Methods
99 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/method[@name="IndexOf(System.String)"]/*'/>
100 internal int IndexOf(string errorMessage)
103 foreach (FbError item in this)
105 if (GlobalizationHelper.CultureAwareCompare(item.Message, errorMessage))
115 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/method[@name="Add(FbError)"]/*'/>
116 internal FbError Add(FbError error)
118 this.errors.Add(error);
123 /// <include file='Doc/en_EN/FbErrorCollection.xml' path='doc/class[@name="FbErrorCollection"]/method[@name="Add(System.String,System.Int32)"]/*'/>
124 internal FbError Add(string errorMessage, int number)
126 FbError error = new FbError(errorMessage, number);
128 return this.Add(error);