Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObjectListDataBindEventArgs.cs
- ToolStripSeparator.cs
- SerializerProvider.cs
- MetadataCollection.cs
- ScriptControlManager.cs
- ToolStripButton.cs
- NamedPipeTransportSecurity.cs
- BufferedGraphicsManager.cs
- ErrorWebPart.cs
- ProtocolsSection.cs
- KernelTypeValidation.cs
- HttpRequestContext.cs
- ListSourceHelper.cs
- SecurityElement.cs
- WebConfigurationHostFileChange.cs
- FontFamily.cs
- DrawingContextWalker.cs
- ListItemCollection.cs
- Vector3DAnimationUsingKeyFrames.cs
- DocumentOrderQuery.cs
- StorageEndPropertyMapping.cs
- TypeSource.cs
- ConstNode.cs
- XmlTextReader.cs
- ConsumerConnectionPoint.cs
- ReadOnlyCollection.cs
- SeverityFilter.cs
- XmlSchemaObjectTable.cs
- PointHitTestParameters.cs
- SafeFileMappingHandle.cs
- ManagedFilter.cs
- ReadOnlyKeyedCollection.cs
- figurelength.cs
- SingleAnimationBase.cs
- XmlUnspecifiedAttribute.cs
- PropertyItem.cs
- HierarchicalDataBoundControl.cs
- SqlRewriteScalarSubqueries.cs
- TextEndOfSegment.cs
- PerformanceCounterPermission.cs
- EndPoint.cs
- ContentType.cs
- UnsafeNativeMethods.cs
- TextEditorCopyPaste.cs
- ParameterBuilder.cs
- XmlSchemaAttributeGroupRef.cs
- RuleValidation.cs
- SqlParameter.cs
- SelectionProcessor.cs
- StrictModeSecurityHeaderElementInferenceEngine.cs
- SkewTransform.cs
- EntityCommandDefinition.cs
- SessionStateUtil.cs
- KeyEvent.cs
- FileStream.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- VisualTreeHelper.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- HostedTransportConfigurationBase.cs
- EntitySqlQueryCacheEntry.cs
- UTF8Encoding.cs
- SqlConnectionFactory.cs
- StyleSheetComponentEditor.cs
- CodeDomConfigurationHandler.cs
- CqlLexerHelpers.cs
- SystemNetHelpers.cs
- CheckBoxField.cs
- BitmapSizeOptions.cs
- Literal.cs
- HandlerWithFactory.cs
- ColorKeyFrameCollection.cs
- SessionEndingEventArgs.cs
- StartUpEventArgs.cs
- LineSegment.cs
- XmlComplianceUtil.cs
- EncryptedPackage.cs
- XmlConvert.cs
- ListViewDeletedEventArgs.cs
- _NestedMultipleAsyncResult.cs
- SecurityElement.cs
- RowUpdatedEventArgs.cs
- QuaternionAnimation.cs
- XmlSchemaInclude.cs
- HtmlContainerControl.cs
- Button.cs
- HtmlUtf8RawTextWriter.cs
- DrawingServices.cs
- SimpleBitVector32.cs
- StringInfo.cs
- InternalMappingException.cs
- UniqueConstraint.cs
- SettingsPropertyWrongTypeException.cs
- AssociationEndMember.cs
- CommentEmitter.cs
- CodeVariableReferenceExpression.cs
- SmiEventStream.cs
- Menu.cs
- ToolStripDropDownItem.cs
- TreeNodeStyleCollection.cs
- ContextBase.cs