-//\r
-// System.Data.Odbc.OdbcErrorCollection\r
-//\r
-// Author:\r
-// Brian Ritchie (brianlritchie@hotmail.com) \r
-//\r
-// Copyright (C) Brian Ritchie, 2002\r
-//\r
+//
+// System.Data.Odbc.OdbcErrorCollection
+//
+// Author:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-\r
-using System.Collections;\r
-using System.ComponentModel;\r
-using System.Data;\r
-using System.Data.Common;\r
-\r
-namespace System.Data.Odbc\r
-{\r
- public sealed class OdbcErrorCollection : ICollection, IEnumerable\r
- {\r
- #region Fields\r
-\r
- ArrayList list = new ArrayList ();\r
- \r
- #endregion // Fields\r
-\r
- #region Constructors\r
-\r
- internal OdbcErrorCollection() {\r
- }\r
-\r
- #endregion Constructors\r
-\r
- #region Properties \r
-\r
- public int Count \r
- {\r
- get \r
- {\r
- return list.Count;\r
- }\r
- }\r
-\r
- public OdbcError this[int index] \r
- {\r
- get \r
- {\r
- return (OdbcError) list[index];\r
- }\r
- }\r
-\r
- object ICollection.SyncRoot \r
- {\r
- get \r
- {\r
- return list.SyncRoot;\r
- }\r
- }\r
-\r
- bool ICollection.IsSynchronized \r
- {\r
- get \r
- {\r
- return list.IsSynchronized;\r
- }\r
- }\r
-\r
- #endregion // Properties\r
-\r
- #region Methods\r
-\r
- internal void Add (OdbcError error)\r
- {\r
- list.Add ((object) error);\r
- }\r
- \r
- public void CopyTo (Array array, int index)\r
- {\r
- if (array == null)\r
- throw new ArgumentNullException("array"); \r
- \r
- if ((index < array.GetLowerBound (0)) || (index > array.GetUpperBound (0)))\r
- throw new ArgumentOutOfRangeException("index");\r
- \r
- // is the check for IsFixedSize required?\r
- if ((array.IsFixedSize) || (index + this.Count > array.GetUpperBound (0)))\r
- throw new ArgumentException("array");\r
-\r
- ((OdbcError[])(list.ToArray ())).CopyTo (array, index);\r
- \r
- }\r
-\r
- public IEnumerator GetEnumerator ()\r
- {\r
- return list.GetEnumerator ();\r
- }\r
-\r
- IEnumerator IEnumerable.GetEnumerator ()\r
- {\r
- return GetEnumerator ();\r
- }\r
-\r
- #endregion // Methods\r
- }\r
-}\r
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ [Serializable]
+ public sealed class OdbcErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList _items = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal OdbcErrorCollection() {
+ }
+
+ #endregion Constructors
+
+ #region Properties
+
+ public int Count
+ {
+ get
+ {
+ return _items.Count;
+ }
+ }
+
+ public OdbcError this[int index]
+ {
+ get
+ {
+ return (OdbcError) _items[index];
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return _items.SyncRoot;
+ }
+ }
+
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return _items.IsSynchronized;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void Add (OdbcError error)
+ {
+ _items.Add ((object) error);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if ((index < array.GetLowerBound (0)) || (index > array.GetUpperBound (0)))
+ throw new ArgumentOutOfRangeException("index");
+
+ // is the check for IsFixedSize required?
+ if ((array.IsFixedSize) || (index + this.Count > array.GetUpperBound (0)))
+ throw new ArgumentException("array");
+
+ ((OdbcError[]) (_items.ToArray ())).CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return _items.GetEnumerator ();
+ }
+
+#if NET_2_0
+ public void CopyTo (OdbcError [] array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ("array");
+
+ if ((index < array.GetLowerBound (0)) || (index > array.GetUpperBound (0)))
+ throw new ArgumentOutOfRangeException ("index");
+ ((OdbcError[]) (_items.ToArray ())).CopyTo (array, index);
+ }
+#endif
+ #endregion // Methods
+ }
+}