diff options
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI/AttributeCollection.cs')
-rwxr-xr-x | mcs/class/System.Web/System.Web.UI/AttributeCollection.cs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs b/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs new file mode 100755 index 00000000000..274c1ab5feb --- /dev/null +++ b/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs @@ -0,0 +1,76 @@ +// +// System.Web.UI.AttributeCollection.cs +// +// Duncan Mak (duncan@ximian.com) +// +// (C) Ximian, Inc. +// + +using System; +using System.Collections; + +namespace System.Web.UI { + + public sealed class AttributeCollection + { + StateBag bag; + Hashtable list; + + public AttributeCollection (StateBag bag) + { + this.bag = bag; + list = new Hashtable (); + } + + public int Count { + get { return list.Count; } + } + + [MonoTODO] + public CssStyleCollection CssStyle { + get { return null; } + } + + public string this [string key] { + get { return list [key] as string; } + + set { list [key] = value; } + } + + public ICollection Keys { + get { return list.Keys; } + } + + public void Add (string key, string value) + { + list.Add (key, value); + } + + public void AddAttributes (HtmlTextWriter writer) + { + foreach (object key in list.Keys) { + + object value = list [key]; + writer.AddAttribute ((string) key, (string) value); + } + } + + public void Clear () + { + list.Clear (); + } + + public void Remove (string key) + { + list.Remove (key); + } + + public void Render (HtmlTextWriter writer) + { + foreach (object key in list.Keys) { + object value = list [key]; + writer.WriteAttribute ((string) key, (string) value); + } + } + } +} |