Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// 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
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NamedElement.cs
- DbConnectionInternal.cs
- ISAPIApplicationHost.cs
- WindowsUpDown.cs
- WebPartManagerInternals.cs
- compensatingcollection.cs
- GPRECTF.cs
- SQLResource.cs
- MatrixKeyFrameCollection.cs
- SystemResourceKey.cs
- BlockExpression.cs
- DotExpr.cs
- DesignerCapabilities.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ReachSerializableProperties.cs
- WebControlToolBoxItem.cs
- CheckBox.cs
- ItemDragEvent.cs
- DesignerLabelAdapter.cs
- GeometryGroup.cs
- ConstraintEnumerator.cs
- DefaultTraceListener.cs
- ThicknessConverter.cs
- NavigationExpr.cs
- XmlTextEncoder.cs
- UnauthorizedAccessException.cs
- EasingKeyFrames.cs
- XhtmlConformanceSection.cs
- XMLUtil.cs
- ConditionCollection.cs
- PathSegmentCollection.cs
- GlyphElement.cs
- PerformanceCounterManager.cs
- UnhandledExceptionEventArgs.cs
- BitmapPalette.cs
- UnhandledExceptionEventArgs.cs
- StylusPointPropertyInfo.cs
- EntityContainerAssociationSet.cs
- PrintPreviewGraphics.cs
- ModuleBuilder.cs
- CqlLexerHelpers.cs
- ObjectFullSpanRewriter.cs
- XamlSerializerUtil.cs
- AssemblyName.cs
- DataSetMappper.cs
- RefExpr.cs
- XmlSchemaNotation.cs
- ServicePrincipalNameElement.cs
- HostnameComparisonMode.cs
- RoleService.cs
- FixedSOMTableRow.cs
- GridErrorDlg.cs
- CacheDependency.cs
- Parser.cs
- _LocalDataStore.cs
- VolatileResourceManager.cs
- SafeEventLogReadHandle.cs
- RecipientInfo.cs
- NumberSubstitution.cs
- ScalarConstant.cs
- ListBindingHelper.cs
- SqlDataSourceView.cs
- altserialization.cs
- ProfileBuildProvider.cs
- FunctionCommandText.cs
- _FtpDataStream.cs
- PointCollection.cs
- LogLogRecordHeader.cs
- PromptEventArgs.cs
- RoutedPropertyChangedEventArgs.cs
- PropertyEmitterBase.cs
- HostProtectionException.cs
- VideoDrawing.cs
- ProxyWebPartManagerDesigner.cs
- OleDbPropertySetGuid.cs
- CodeTypeReferenceCollection.cs
- UnknownWrapper.cs
- ModelPerspective.cs
- xmlfixedPageInfo.cs
- XmlObjectSerializerReadContextComplexJson.cs
- counter.cs
- JpegBitmapDecoder.cs
- ToolStripItemDataObject.cs
- SettingsPropertyValueCollection.cs
- QuaternionKeyFrameCollection.cs
- TraceContextRecord.cs
- AnnotationComponentManager.cs
- FontUnit.cs
- AsymmetricSignatureFormatter.cs
- DataGridViewElement.cs
- TTSVoice.cs
- RequestContext.cs
- BuilderPropertyEntry.cs
- DropTarget.cs
- TogglePattern.cs
- LineServices.cs
- xmlfixedPageInfo.cs
- PersistenceContext.cs
- PackageFilter.cs
- StrokeIntersection.cs