OdbcErrorCollection.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //------------------------------------------------------------------------------
  2. // <copyright file="OdbcErrorCollection.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. // <owner current="true" primary="true">[....]</owner>
  6. // <owner current="true" primary="false">[....]</owner>
  7. //------------------------------------------------------------------------------
  8. namespace System.Data.Odbc {
  9. using System;
  10. using System.Collections;
  11. using System.Data;
  12. [Serializable]
  13. public sealed class OdbcErrorCollection : ICollection {
  14. private ArrayList _items = new ArrayList();
  15. internal OdbcErrorCollection() {
  16. }
  17. Object System.Collections.ICollection.SyncRoot {
  18. get { return this; }
  19. }
  20. bool System.Collections.ICollection.IsSynchronized {
  21. get { return false; }
  22. }
  23. public int Count {
  24. get {
  25. return _items.Count;
  26. }
  27. }
  28. public OdbcError this[int i] {
  29. get {
  30. return (OdbcError)_items[i];
  31. }
  32. }
  33. internal void Add(OdbcError error) {
  34. _items.Add(error);
  35. }
  36. public void CopyTo (Array array, int i) {
  37. _items.CopyTo(array, i);
  38. }
  39. public void CopyTo (OdbcError[] array, int i) {
  40. _items.CopyTo(array, i);
  41. }
  42. public IEnumerator GetEnumerator() {
  43. return _items.GetEnumerator();
  44. }
  45. internal void SetSource (string Source) {
  46. foreach (object error in _items) {
  47. ((OdbcError)error).SetSource(Source);
  48. }
  49. }
  50. }
  51. }