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