SqlErrorCollection.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // System.Data.SqlClient.SqlErrorCollection.cs
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. // Daniel Morgan ([email protected])
  7. // Tim Coleman ([email protected])
  8. //
  9. // (C) Ximian, Inc 2002
  10. // Copyright (C) Tim Coleman, 2002
  11. //
  12. using System;
  13. using System.Collections;
  14. using System.ComponentModel;
  15. using System.Data;
  16. using System.Runtime.InteropServices;
  17. namespace System.Data.SqlClient {
  18. [ListBindable (false)]
  19. [Serializable]
  20. public sealed class SqlErrorCollection : ICollection, IEnumerable
  21. {
  22. #region Fields
  23. ArrayList list = new ArrayList();
  24. #endregion // Fields
  25. #region Constructors
  26. internal SqlErrorCollection ()
  27. {
  28. }
  29. internal SqlErrorCollection (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
  30. {
  31. Add (theClass, lineNumber, message, number, procedure, server, source, state);
  32. }
  33. #endregion // Constructors
  34. #region Properties
  35. public int Count {
  36. get { return list.Count; }
  37. }
  38. bool ICollection.IsSynchronized {
  39. get { return list.IsSynchronized; }
  40. }
  41. object ICollection.SyncRoot {
  42. get { return list.SyncRoot; }
  43. }
  44. public SqlError this[int index] {
  45. get { return (SqlError) list [index]; }
  46. }
  47. #endregion
  48. #region Methods
  49. internal void Add(SqlError error)
  50. {
  51. list.Add (error);
  52. }
  53. internal void Add(byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
  54. {
  55. SqlError error = new SqlError (theClass, lineNumber, message, number, procedure, server, source, state);
  56. Add (error);
  57. }
  58. public void CopyTo (Array array, int index)
  59. {
  60. list.CopyTo (array, index);
  61. }
  62. public IEnumerator GetEnumerator()
  63. {
  64. return list.GetEnumerator ();
  65. }
  66. #endregion
  67. }
  68. }