Merge pull request #944 from ermshiperete/bug-novell-496138
[mono.git] / mcs / class / System / System.Configuration / SettingsProviderCollection.cs
index 8d9e02a0102aabeb9a0c50df3905ff6c667f33b7..8f5548d658014f9dd2ee225e5c2d0d168268d69b 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System;
+using System.Collections;
+#if (CONFIGURATION_DEP)
 using System.Configuration.Provider;
+#endif
 
 namespace System.Configuration
 {
-       public class SettingsProviderCollection : System.Configuration.Provider.ProviderCollection
+       public class SettingsProviderCollection
+#if (CONFIGURATION_DEP)
+               : ProviderCollection
+#endif
        {
                public SettingsProviderCollection ()
                {
-                               throw new NotImplementedException ();
                }
 
+#if (CONFIGURATION_DEP)
                public override void Add (ProviderBase provider)
                {
-                               throw new NotImplementedException ();
+                       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);
                }
 
                public new SettingsProvider this [ string name ] { 
                        get {
-                               throw new NotImplementedException ();
+                               return (SettingsProvider) base [ name ];
                        }
                }
+#endif
        }
 }
 
-#endif