2
0

OleDbErrorCollection.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // System.Data.OleDb.OleDbErrorCollection
  3. //
  4. // Authors:
  5. // Rodrigo Moya ([email protected])
  6. // Tim Coleman ([email protected])
  7. //
  8. // Copyright (C) Rodrigo Moya, 2002
  9. // Copyright (C) Tim Coleman, 2002
  10. //
  11. using System.Collections;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Data.Common;
  15. namespace System.Data.OleDb
  16. {
  17. [ListBindableAttribute ( false)]
  18. public sealed class OleDbErrorCollection : ICollection, IEnumerable
  19. {
  20. #region Fields
  21. ArrayList list;
  22. #endregion // Fields
  23. #region Properties
  24. public int Count {
  25. get {
  26. return list.Count;
  27. }
  28. }
  29. public OleDbError this[int index] {
  30. get {
  31. return (OleDbError) list[index];
  32. }
  33. }
  34. object ICollection.SyncRoot {
  35. get {
  36. return list.SyncRoot;
  37. }
  38. }
  39. bool ICollection.IsSynchronized {
  40. get {
  41. return list.IsSynchronized;
  42. }
  43. }
  44. #endregion // Properties
  45. #region Methods
  46. internal void Add (OleDbError error)
  47. {
  48. list.Add ((object) error);
  49. }
  50. public void CopyTo (Array array, int index)
  51. {
  52. if (array == null)
  53. throw new ArgumentNullException("array");
  54. if ((index < array.GetLowerBound (0)) || (index > array.GetUpperBound (0)))
  55. throw new ArgumentOutOfRangeException("index");
  56. // is the check for IsFixedSize required?
  57. if ((array.IsFixedSize) || (index + this.Count > array.GetUpperBound (0)))
  58. throw new ArgumentException("array");
  59. ((OleDbError[])(list.ToArray ())).CopyTo (array, index);
  60. }
  61. public IEnumerator GetEnumerator ()
  62. {
  63. return list.GetEnumerator ();
  64. }
  65. IEnumerator IEnumerable.GetEnumerator ()
  66. {
  67. return GetEnumerator ();
  68. }
  69. #endregion // Methods
  70. }
  71. }