Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / FilteredAttributeCollection.cs / 1 / FilteredAttributeCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; using System.Collections.Specialized; using System.Globalization; ////// Contains a filtered (by device filter) view of the attributes parsed from a tag /// internal sealed class FilteredAttributeDictionary : IDictionary { private string _filter; private IDictionary _data; private ParsedAttributeCollection _owner; internal FilteredAttributeDictionary(ParsedAttributeCollection owner, string filter) { _filter = filter; _owner = owner; _data = new ListDictionary(StringComparer.OrdinalIgnoreCase); } ////// The actual dictionary used for storing the data /// internal IDictionary Data { get { return _data; } } ////// The filter that this collection is filtering on /// public string Filter { get { return _filter; } } ////// Returns the value of a particular attribute for this filter /// public string this[string key] { get { return (string)_data[key]; } set { _owner.ReplaceFilteredAttribute(_filter, key, value); } } ////// Adds a new attribute for this filter /// public void Add(string key, string value) { _owner.AddFilteredAttribute(_filter, key, value); } ////// Clears all attributes for this filter /// public void Clear() { _owner.ClearFilter(_filter); } ////// Returns true if this filtered view contains the specified attribute /// public bool Contains(string key) { return _data.Contains(key); } ////// Removes the specified attribute for this filter /// public void Remove(string key) { _owner.RemoveFilteredAttribute(_filter, key); } #region IDictionary implementation ///bool IDictionary.IsFixedSize { get { return false; } } /// bool IDictionary.IsReadOnly { get { return false; } } /// object IDictionary.this[object key] { get { if (!(key is string)) { throw new ArgumentException(SR.GetString(SR.FilteredAttributeDictionary_ArgumentMustBeString), "key"); } return this[key.ToString()]; } set { if (!(key is string)) { throw new ArgumentException(SR.GetString(SR.FilteredAttributeDictionary_ArgumentMustBeString), "key"); } if (!(value is string)) { throw new ArgumentException(SR.GetString(SR.FilteredAttributeDictionary_ArgumentMustBeString), "value"); } this[key.ToString()] = value.ToString(); } } /// ICollection IDictionary.Keys { get { return _data.Keys; } } /// ICollection IDictionary.Values { get { return _data.Values; } } /// void IDictionary.Add(object key, object value) { if (key == null) { throw new ArgumentNullException("key"); } if (!(key is string)) { throw new ArgumentException(SR.GetString(SR.FilteredAttributeDictionary_ArgumentMustBeString), "key"); } if (!(value is string)) { throw new ArgumentException(SR.GetString(SR.FilteredAttributeDictionary_ArgumentMustBeString), "value"); } if (value == null) { value = String.Empty; } Add(key.ToString(), value.ToString()); } /// bool IDictionary.Contains(object key) { if (!(key is string)) { throw new ArgumentException(SR.GetString(SR.FilteredAttributeDictionary_ArgumentMustBeString), "key"); } return Contains(key.ToString()); } /// void IDictionary.Clear() { Clear(); } /// IDictionaryEnumerator IDictionary.GetEnumerator() { return _data.GetEnumerator(); } /// void IDictionary.Remove(object key) { Remove(key.ToString()); } #endregion IDictionary implementation #region ICollection implementation /// int ICollection.Count { get { return _data.Count; } } /// bool ICollection.IsSynchronized { get { return ((ICollection)_data).IsSynchronized; } } /// object ICollection.SyncRoot { get { return _data.SyncRoot; } } /// void ICollection.CopyTo(Array array, int index) { _data.CopyTo(array, index); } /// IEnumerator IEnumerable.GetEnumerator() { return _data.GetEnumerator(); } #endregion ICollection implementation } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BamlLocalizerErrorNotifyEventArgs.cs
- LookupBindingPropertiesAttribute.cs
- CopyAttributesAction.cs
- UnsafeNativeMethods.cs
- MessageQueueTransaction.cs
- ToolStripSeparator.cs
- BitmapEffectInput.cs
- GPPOINT.cs
- AlternateView.cs
- DomainUpDown.cs
- dataprotectionpermission.cs
- EncodingNLS.cs
- FileDialog_Vista_Interop.cs
- RegexStringValidator.cs
- DetailsViewPagerRow.cs
- DataGridViewEditingControlShowingEventArgs.cs
- PropertiesTab.cs
- ArrayListCollectionBase.cs
- TargetControlTypeCache.cs
- PerfCounterSection.cs
- CheckBoxPopupAdapter.cs
- SingleConverter.cs
- CodeIterationStatement.cs
- DateTimeOffset.cs
- PassportPrincipal.cs
- AbandonedMutexException.cs
- TextEditorSpelling.cs
- ParserStack.cs
- DataError.cs
- AppDomainUnloadedException.cs
- RsaSecurityToken.cs
- TextEndOfParagraph.cs
- TypeUtil.cs
- OracleConnectionStringBuilder.cs
- CodeNamespaceCollection.cs
- RtfControls.cs
- SafeUserTokenHandle.cs
- Vector.cs
- SafeEventLogWriteHandle.cs
- DrawingContextWalker.cs
- DocumentOrderComparer.cs
- HttpWriter.cs
- XmlDataSource.cs
- ConvertEvent.cs
- BinaryWriter.cs
- SynchronizedDispatch.cs
- Blend.cs
- DisplayInformation.cs
- VisualBrush.cs
- ClientUrlResolverWrapper.cs
- SrgsElementList.cs
- VectorKeyFrameCollection.cs
- ComboBox.cs
- SamlSecurityToken.cs
- RegexCapture.cs
- XmlWrappingReader.cs
- DataGridViewElement.cs
- InternalCache.cs
- ContentType.cs
- CounterCreationDataCollection.cs
- RuntimeHandles.cs
- ObjectDataSourceStatusEventArgs.cs
- GridProviderWrapper.cs
- EdmItemError.cs
- SqlUDTStorage.cs
- DataGridViewCellStyleEditor.cs
- XmlCharCheckingReader.cs
- EventLogPermissionEntryCollection.cs
- BindingBase.cs
- ContourSegment.cs
- AbandonedMutexException.cs
- OptimisticConcurrencyException.cs
- HostSecurityManager.cs
- CustomError.cs
- DateTimeFormatInfo.cs
- DesignerActionUIService.cs
- FormsAuthenticationUser.cs
- CookieHandler.cs
- ScriptReference.cs
- SortedList.cs
- AspCompat.cs
- DefaultShape.cs
- _NTAuthentication.cs
- DirectoryObjectSecurity.cs
- WindowsHyperlink.cs
- ClrProviderManifest.cs
- DesignerUtils.cs
- InstanceCreationEditor.cs
- WeakHashtable.cs
- LocalizableResourceBuilder.cs
- OutputCacheSettings.cs
- SqlGatherConsumedAliases.cs
- ContentFilePart.cs
- KeyConstraint.cs
- Help.cs
- Group.cs
- CheckedPointers.cs
- IsolatedStorageFile.cs
- InstanceKeyCompleteException.cs
- Pair.cs