2 // System.Web.Configuration.CompilerProviderOptionsCollection.cs
5 // Marek Habersack (mhabersack@novell.com)
7 // (C) 2007 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #if NET_2_0 && CONFIGURATION_DEP
33 using System.Configuration;
34 using System.Collections.Generic;
36 namespace System.CodeDom.Compiler
38 [ConfigurationCollection (typeof (CompilerProviderOption), CollectionType = ConfigurationElementCollectionType.BasicMap, AddItemName = "providerOption")]
39 internal sealed class CompilerProviderOptionsCollection : ConfigurationElementCollection
41 static ConfigurationPropertyCollection properties;
43 static CompilerProviderOptionsCollection ()
45 properties = new ConfigurationPropertyCollection ();
48 public CompilerProviderOptionsCollection ()
52 protected override ConfigurationElement CreateNewElement ()
54 return new CompilerProviderOption ();
57 public CompilerProviderOption Get (int index)
59 return (CompilerProviderOption) BaseGet (index);
62 public CompilerProviderOption Get (string name)
64 return (CompilerProviderOption) BaseGet (name);
67 protected override object GetElementKey (ConfigurationElement element)
69 return ((CompilerProviderOption) element).Name;
72 public string GetKey (int index)
74 return (string) BaseGetKey (index);
77 public string[] AllKeys {
80 string[] keys = new string [count];
81 for (int i = 0; i < count; i++)
82 keys [i] = this [i].Name;
88 protected override string ElementName {
89 get { return "providerOption"; }
92 protected override ConfigurationPropertyCollection Properties {
93 get { return properties; }
96 public Dictionary <string, string> ProviderOptions {
103 Dictionary <string, string> ret = new Dictionary <string, string> (count);
104 CompilerProviderOption opt;
106 for (int i = 0; i < count; i++) {
108 ret.Add (opt.Name, opt.Value);
115 public CompilerProviderOption this [int index] {
116 get { return (CompilerProviderOption) BaseGet (index); }
119 public new CompilerProviderOption this [string name] {
121 foreach (CompilerProviderOption c in this) {