Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / UI / FilterableAttribute.cs / 1 / FilterableAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI { using System; using System.Collections; using System.ComponentModel; using System.Security.Permissions; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)] public sealed class FilterableAttribute : Attribute { ////// /// /// public static readonly FilterableAttribute Yes = new FilterableAttribute(true); ////// /// /// public static readonly FilterableAttribute No = new FilterableAttribute(false); ////// /// /// public static readonly FilterableAttribute Default = Yes; private bool _filterable = false; private static Hashtable _filterableTypes; static FilterableAttribute() { // Create a synchronized wrapper _filterableTypes = Hashtable.Synchronized(new Hashtable()); } ////// /// public FilterableAttribute(bool filterable) { _filterable = filterable; } ////// public bool Filterable { get { return _filterable; } } ///Indicates if the property is Filterable. ///public override bool Equals(object obj) { if (obj == this) { return true; } FilterableAttribute other = obj as FilterableAttribute; return (other != null) && (other.Filterable == _filterable); } /// public override int GetHashCode() { return _filterable.GetHashCode(); } /// public override bool IsDefaultAttribute() { return this.Equals(Default); } public static bool IsObjectFilterable(Object instance) { if (instance == null) throw new ArgumentNullException("instance"); return IsTypeFilterable(instance.GetType()); } public static bool IsPropertyFilterable(PropertyDescriptor propertyDescriptor) { FilterableAttribute filterableAttr = (FilterableAttribute)propertyDescriptor.Attributes[typeof(FilterableAttribute)]; if (filterableAttr != null) { return filterableAttr.Filterable; } return true; } public static bool IsTypeFilterable(Type type) { if (type == null) throw new ArgumentNullException("type"); object result = _filterableTypes[type]; if (result != null) { return (bool)result; } System.ComponentModel.AttributeCollection attrs = TypeDescriptor.GetAttributes(type); FilterableAttribute attr = (FilterableAttribute)attrs[typeof(FilterableAttribute)]; result = (attr != null) && attr.Filterable; _filterableTypes[type] = result; return (bool)result; } } } // 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.ComponentModel; using System.Security.Permissions; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)] public sealed class FilterableAttribute : Attribute { ////// /// /// public static readonly FilterableAttribute Yes = new FilterableAttribute(true); ////// /// /// public static readonly FilterableAttribute No = new FilterableAttribute(false); ////// /// /// public static readonly FilterableAttribute Default = Yes; private bool _filterable = false; private static Hashtable _filterableTypes; static FilterableAttribute() { // Create a synchronized wrapper _filterableTypes = Hashtable.Synchronized(new Hashtable()); } ////// /// public FilterableAttribute(bool filterable) { _filterable = filterable; } ////// public bool Filterable { get { return _filterable; } } ///Indicates if the property is Filterable. ///public override bool Equals(object obj) { if (obj == this) { return true; } FilterableAttribute other = obj as FilterableAttribute; return (other != null) && (other.Filterable == _filterable); } /// public override int GetHashCode() { return _filterable.GetHashCode(); } /// public override bool IsDefaultAttribute() { return this.Equals(Default); } public static bool IsObjectFilterable(Object instance) { if (instance == null) throw new ArgumentNullException("instance"); return IsTypeFilterable(instance.GetType()); } public static bool IsPropertyFilterable(PropertyDescriptor propertyDescriptor) { FilterableAttribute filterableAttr = (FilterableAttribute)propertyDescriptor.Attributes[typeof(FilterableAttribute)]; if (filterableAttr != null) { return filterableAttr.Filterable; } return true; } public static bool IsTypeFilterable(Type type) { if (type == null) throw new ArgumentNullException("type"); object result = _filterableTypes[type]; if (result != null) { return (bool)result; } System.ComponentModel.AttributeCollection attrs = TypeDescriptor.GetAttributes(type); FilterableAttribute attr = (FilterableAttribute)attrs[typeof(FilterableAttribute)]; result = (attr != null) && attr.Filterable; _filterableTypes[type] = result; return (bool)result; } } } // 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
- WebPartMovingEventArgs.cs
- RecipientIdentity.cs
- ReadOnlyHierarchicalDataSource.cs
- AuthorizationRule.cs
- ObjectDataSourceEventArgs.cs
- Expander.cs
- WMICapabilities.cs
- Dispatcher.cs
- ServiceOperationParameter.cs
- EdmToObjectNamespaceMap.cs
- ForwardPositionQuery.cs
- SpecularMaterial.cs
- CancellationScope.cs
- Simplifier.cs
- CatalogZoneBase.cs
- HttpProfileGroupBase.cs
- DiagnosticTrace.cs
- ObjectParameterCollection.cs
- SqlIdentifier.cs
- GenericParameterDataContract.cs
- TreeWalker.cs
- FontNameConverter.cs
- ToolStripGripRenderEventArgs.cs
- TopClause.cs
- followingquery.cs
- propertytag.cs
- WebConfigurationHost.cs
- NumberFormatInfo.cs
- FormViewUpdatedEventArgs.cs
- TextControl.cs
- TableRowsCollectionEditor.cs
- ClientFactory.cs
- InfiniteTimeSpanConverter.cs
- FamilyTypeface.cs
- BamlLocalizationDictionary.cs
- HtmlTable.cs
- MediaTimeline.cs
- RelationshipNavigation.cs
- DesignerAutoFormat.cs
- FieldNameLookup.cs
- SQLGuid.cs
- Permission.cs
- ScheduleChanges.cs
- LinqTreeNodeEvaluator.cs
- Duration.cs
- ExtentKey.cs
- NameHandler.cs
- StopStoryboard.cs
- DataFormats.cs
- BuildManagerHost.cs
- ErrorFormatter.cs
- Privilege.cs
- CacheOutputQuery.cs
- Debug.cs
- FixedDSBuilder.cs
- PrimaryKeyTypeConverter.cs
- SchemaContext.cs
- HttpListener.cs
- SmiContext.cs
- RSAProtectedConfigurationProvider.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- RecommendedAsConfigurableAttribute.cs
- FloaterParagraph.cs
- DropShadowBitmapEffect.cs
- StandardTransformFactory.cs
- Int32CAMarshaler.cs
- SafeTokenHandle.cs
- OletxDependentTransaction.cs
- QueryContinueDragEvent.cs
- CalendarTable.cs
- KeyBinding.cs
- DateTimeFormatInfoScanner.cs
- SafeProcessHandle.cs
- SqlGatherProducedAliases.cs
- SmiMetaDataProperty.cs
- EnumValidator.cs
- NotFiniteNumberException.cs
- AccessDataSource.cs
- RightNameExpirationInfoPair.cs
- ExpressionNode.cs
- EventLogPermissionEntryCollection.cs
- AssemblyHash.cs
- BadImageFormatException.cs
- CharacterString.cs
- CustomDictionarySources.cs
- LinkLabel.cs
- CustomCategoryAttribute.cs
- RowSpanVector.cs
- HttpCachePolicyElement.cs
- _NegoStream.cs
- UpdateExpressionVisitor.cs
- BigInt.cs
- DataPagerFieldCommandEventArgs.cs
- PropertyKey.cs
- securestring.cs
- MarkupProperty.cs
- COM2PictureConverter.cs
- Opcode.cs
- BaseValidator.cs
- Grammar.cs