Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / System / System.Configuration / SettingsProviderCollection.cs
index 566e46ada026a65b5968fe2e2760f9c4d8308e43..8f5548d658014f9dd2ee225e5c2d0d168268d69b 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System;
 using System.Collections;
 #if (CONFIGURATION_DEP)
@@ -40,26 +39,26 @@ namespace System.Configuration
                : ProviderCollection
 #endif
        {
-               Hashtable providers;
-
                public SettingsProviderCollection ()
                {
-                       providers = new Hashtable ();
                }
 
 #if (CONFIGURATION_DEP)
                public override void Add (ProviderBase provider)
                {
-                       providers.Add (provider.Name, provider);
+                       if (!(provider is SettingsProvider))
+                               throw new ArgumentException ("SettingsProvider is expected");
+                       if (String.IsNullOrEmpty (provider.Name))
+                               throw new ArgumentException ("Provider name cannot be null or empty");
+                       base.Add (provider);
                }
-#endif
 
                public new SettingsProvider this [ string name ] { 
                        get {
-                               return (SettingsProvider)providers [ name ];
+                               return (SettingsProvider) base [ name ];
                        }
                }
+#endif
        }
 }
 
-#endif