Merge pull request #2916 from ludovic-henry/fix-40306
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / ExpressionBuilderCollection.cs
index 76c4aea63a855d2afba39b97c0e20a2db9183941..6cf89269cc3b4954f851b6e662315c8da92363fd 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if NET_2_0
 using System;
 using System.Collections;
 using System.Configuration;
 
 namespace System.Web.Configuration
 {
+       [ConfigurationCollection (typeof (ExpressionBuilder), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
        public sealed class ExpressionBuilderCollection : ConfigurationElementCollection
        {
                static ConfigurationPropertyCollection props;
@@ -41,9 +41,6 @@ namespace System.Web.Configuration
                static ExpressionBuilderCollection ()
                {
                        props = new ConfigurationPropertyCollection ();
-                       ConfigurationPropertyOptions flags = ConfigurationPropertyOptions.IsDefaultCollection;
-                       ConfigurationProperty prop = new ConfigurationProperty (null, typeof (ExpressionBuilderCollection), null, flags);
-                       props.Add (prop);
                }
                
                public ExpressionBuilderCollection (): base (CaseInsensitiveComparer.DefaultInvariant)
@@ -52,19 +49,14 @@ namespace System.Web.Configuration
 
                public ExpressionBuilder this [int index] {
                        get { return (ExpressionBuilder) BaseGet (index); }
-                       set {
-                               if (BaseGet (index) != null)
-                                       BaseRemoveAt (index);
-
-                               BaseAdd (index, value);
-                       }
+                       set { if (BaseGet (index) != null) BaseRemoveAt (index); BaseAdd (index, value); }
                }
 
                public new ExpressionBuilder this [string name] {
                        get { return (ExpressionBuilder) BaseGet (name); }
                }
 
-               protected override ConfigurationPropertyCollection Properties {
+               protected internal override ConfigurationPropertyCollection Properties {
                        get { return props; }
                }
 
@@ -100,5 +92,4 @@ namespace System.Web.Configuration
                }
        }
 }
-#endif // NET_2_0