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
- webbrowsersite.cs
- CompilerCollection.cs
- SrgsElement.cs
- XslUrlEditor.cs
- ConfigurationManagerInternalFactory.cs
- DurableInstanceProvider.cs
- CookieParameter.cs
- UnaryNode.cs
- MetaChildrenColumn.cs
- HostSecurityManager.cs
- FilterException.cs
- HtmlGenericControl.cs
- UriGenerator.cs
- XamlTreeBuilder.cs
- SqlBuffer.cs
- HtmlWindowCollection.cs
- webeventbuffer.cs
- AssemblyBuilder.cs
- FrameworkTextComposition.cs
- TextRange.cs
- HttpCapabilitiesSectionHandler.cs
- EmptyImpersonationContext.cs
- ComboBoxItem.cs
- DocumentApplicationJournalEntry.cs
- CFGGrammar.cs
- BinHexEncoder.cs
- ConfigurationManager.cs
- InternalUserCancelledException.cs
- TransformerInfo.cs
- Path.cs
- RenderOptions.cs
- ReadOnlyDataSource.cs
- CodeSubDirectory.cs
- DataGridTextBox.cs
- SubclassTypeValidator.cs
- SystemIPGlobalProperties.cs
- SafeUserTokenHandle.cs
- ModifierKeysValueSerializer.cs
- ImageAttributes.cs
- Cursor.cs
- Int16.cs
- EntityKey.cs
- ColumnResult.cs
- RawKeyboardInputReport.cs
- TouchesCapturedWithinProperty.cs
- GridItemCollection.cs
- XamlSerializer.cs
- ToolStripGripRenderEventArgs.cs
- XamlContextStack.cs
- XmlKeywords.cs
- ListSortDescriptionCollection.cs
- FlowDocument.cs
- AnimatedTypeHelpers.cs
- StateItem.cs
- GridLengthConverter.cs
- StylusPoint.cs
- ResXBuildProvider.cs
- NotImplementedException.cs
- ModelVisual3D.cs
- ContractMapping.cs
- DataStorage.cs
- StringBuilder.cs
- PropertyPathWorker.cs
- SHA512CryptoServiceProvider.cs
- DrawingImage.cs
- RequestCacheManager.cs
- GcHandle.cs
- ZipIOBlockManager.cs
- BitmapSizeOptions.cs
- BindStream.cs
- DataTableCollection.cs
- ListBoxItemWrapperAutomationPeer.cs
- ConfigurationSection.cs
- XmlUtil.cs
- DynamicControlParameter.cs
- WebControlsSection.cs
- RawMouseInputReport.cs
- TransformerConfigurationWizardBase.cs
- DeliveryStrategy.cs
- DictionaryCustomTypeDescriptor.cs
- JsonCollectionDataContract.cs
- CodeConstructor.cs
- NetDispatcherFaultException.cs
- StylusButtonCollection.cs
- HtmlValidatorAdapter.cs
- TrackingDataItem.cs
- Facet.cs
- HiddenFieldPageStatePersister.cs
- RecipientInfo.cs
- PrintDialogException.cs
- ReflectionPermission.cs
- NavigationFailedEventArgs.cs
- ResourceDictionaryCollection.cs
- CacheAxisQuery.cs
- PrivacyNoticeBindingElement.cs
- WebPartDisplayModeCancelEventArgs.cs
- ActivityStateQuery.cs
- SessionEndingEventArgs.cs
- RepeatInfo.cs
- ParameterToken.cs