PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/mcs/tools/sqlsharp/gui/gtk-sharp/DbProviderCollection.cs

https://bitbucket.org/danipen/mono
C# | 147 lines | 107 code | 30 blank | 10 comment | 1 complexity | 2115586e00189a30659169d3c51fbea8 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. //
  2. // DbProviderCollection.cs
  3. //
  4. // Author:
  5. // Daniel Morgan <danmorg@sc.rr.com>
  6. //
  7. // (C)Copyright 2002 by Daniel Morgan
  8. //
  9. // To be included with Mono as a SQL query tool licensed under the GPL license.
  10. //
  11. namespace Mono.Data.SqlSharp.Gui.GtkSharp
  12. {
  13. using System;
  14. using System.Data;
  15. using System.Collections;
  16. public class DbProviderCollection : MarshalByRefObject, IList, ICollection, IEnumerable
  17. {
  18. #region Fields
  19. ArrayList list = new ArrayList ();
  20. #endregion // Fields
  21. #region Constructors
  22. public DbProviderCollection ()
  23. {
  24. }
  25. #endregion // Constructors
  26. #region Properties
  27. public DbProvider this[int index] {
  28. get {
  29. return (DbProvider) list[index];
  30. }
  31. }
  32. public DbProvider this[string key] {
  33. get {
  34. DbProvider p = null;
  35. foreach(object o in list) {
  36. p = (DbProvider) o;
  37. if(p.Key.ToUpper().Equals(key.ToUpper())) {
  38. return p;
  39. }
  40. }
  41. throw new Exception("DbProvider not found");
  42. }
  43. }
  44. object IList.this[int index] {
  45. get {
  46. return list[index];
  47. }
  48. set {
  49. list[index] = value;
  50. }
  51. }
  52. public int Count {
  53. get {
  54. return list.Count;
  55. }
  56. }
  57. public bool IsFixedSize {
  58. get {
  59. return false;
  60. }
  61. }
  62. public bool IsReadOnly {
  63. get {
  64. return true;
  65. }
  66. }
  67. public bool IsSynchronized {
  68. get {
  69. return false;
  70. }
  71. }
  72. public object SyncRoot {
  73. get {
  74. throw new InvalidOperationException ();
  75. }
  76. }
  77. #endregion // Properties
  78. #region Methods
  79. public int Add (object o)
  80. {
  81. return list.Add ((DbProvider) o);
  82. }
  83. public void Clear ()
  84. {
  85. list.Clear ();
  86. }
  87. public bool Contains (object o)
  88. {
  89. return list.Contains ((DbProvider) o);
  90. }
  91. public void CopyTo (Array array, int index)
  92. {
  93. list.CopyTo (array, index);
  94. }
  95. public IEnumerator GetEnumerator ()
  96. {
  97. return list.GetEnumerator ();
  98. }
  99. public int IndexOf (object o)
  100. {
  101. return list.IndexOf ((DbProvider) o);
  102. }
  103. public void Insert (int index, object o)
  104. {
  105. list.Insert (index, (DbProvider) o);
  106. }
  107. public void Remove (object o)
  108. {
  109. list.Remove ((DbProvider) o);
  110. }
  111. public void RemoveAt (int index)
  112. {
  113. list.RemoveAt (index);
  114. }
  115. #endregion // Methods
  116. }
  117. }