2005-11-18 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / AssemblyCollection.cs
index c663fb13e0a9d7b3e7d83b4ea50da740b30615e9..6be2a4e9d045e1a6f9be4a86aafc3d02cb39fdd4 100644 (file)
@@ -3,8 +3,9 @@
 //
 // Authors:
 //     Lluis Sanchez Gual (lluis@novell.com)
+//     Chris Toshok (toshok@ximian.com)
 //
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004,2005 Novell, Inc (http://www.novell.com)
 //
 
 //
@@ -35,8 +36,16 @@ using System.Configuration;
 
 namespace System.Web.Configuration
 {
+       [ConfigurationCollection (typeof (AssemblyInfo), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
        public sealed class AssemblyCollection: ConfigurationElementCollection
        {
+               static ConfigurationPropertyCollection properties;
+
+               static AssemblyCollection ()
+               {
+                       properties = new ConfigurationPropertyCollection();
+               }
+
                public void Add (AssemblyInfo info)
                {
                        BaseAdd (info);
@@ -66,10 +75,19 @@ namespace System.Web.Configuration
                {
                        BaseRemoveAt (index);
                }
-               
-               public AssemblyInfo this [int n]
-               {
-                       get { return (AssemblyInfo) BaseGet (n); }
+
+               public AssemblyInfo this [int index] {
+                       get { return (AssemblyInfo) BaseGet (index); }
+                       set {  if (BaseGet(index) != null)  BaseRemoveAt(index);  BaseAdd(index, value); }
+               }
+
+               public new AssemblyInfo this [string assemblyName] {
+                       get { return (AssemblyInfo) BaseGet (assemblyName); }
+               }
+
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
                }
        }
 }