* TagAttribute.cs: attributes can be stored as encoded html so we
[mono.git] / mcs / class / System.Web / System.Web / SiteMapProviderCollection.cs
1 //
2 // System.Web.SiteMapProviderCollection
3 //
4 // Authors:
5 //      Ben Maurer (bmaurer@users.sourceforge.net)
6 //
7 // (C) 2003 Ben Maurer
8 //
9
10 #if NET_1_2
11 using System.Collections;
12 using System.Collections.Specialized;
13 using System.Text;
14 using System.Configuration.Provider;
15 using System.Web.UI;
16
17 namespace System.Web {
18         public class SiteMapProviderCollection : ProviderCollection
19         {
20                 public SiteMapProviderCollection () {}
21                 
22                 public override void Add (IProvider provider)
23                 {
24                         if (provider == null)
25                                 throw new ArgumentNullException ("provider");
26                         if ((provider as ISiteMapProvider) == null)
27                                 throw new InvalidOperationException(String.Format ("{0} must implement {1} to act as a site map provider", provider.GetType (), typeof (ISiteMapProvider)));
28                         
29                         base.Add (provider);
30                 }
31                 
32                 public virtual void AddArray (IProvider[] providerArray)
33                 {                       
34                         foreach (IProvider p in providerArray) {
35                                 if (this [p.Name] != null)
36                                         throw new ArgumentException ("Duplicate site map providers");
37                                 Add (p);
38                         }
39                 }
40                 
41                 public ISiteMapProvider this [string name] { get { return (ISiteMapProvider) base [name]; } }
42         }
43 }
44 #endif
45