Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ChannelManager.cs
- ConfigXmlComment.cs
- StaticDataManager.cs
- AttachmentService.cs
- ButtonBaseAutomationPeer.cs
- QueryAccessibilityHelpEvent.cs
- HtmlProps.cs
- Latin1Encoding.cs
- ListDictionary.cs
- SQLMoney.cs
- ConnectAlgorithms.cs
- Span.cs
- TextEmbeddedObject.cs
- NavigationHelper.cs
- SiteMapDesignerDataSourceView.cs
- CodeAttributeDeclarationCollection.cs
- RichTextBox.cs
- TreeViewImageGenerator.cs
- SynchronizedInputAdaptor.cs
- DataSourceXmlElementAttribute.cs
- InkCanvasSelection.cs
- RadioButtonRenderer.cs
- ControlPaint.cs
- EventData.cs
- EntityStoreSchemaFilterEntry.cs
- Separator.cs
- DebugManager.cs
- SHA1CryptoServiceProvider.cs
- XmlSchemaComplexContentRestriction.cs
- PersonalizationProvider.cs
- ListBase.cs
- SharedDp.cs
- BatchWriter.cs
- Drawing.cs
- TextDecorationUnitValidation.cs
- MaskedTextBoxTextEditor.cs
- Image.cs
- TableDesigner.cs
- TabControlAutomationPeer.cs
- XsltQilFactory.cs
- BindStream.cs
- UnsafeNativeMethods.cs
- Activation.cs
- ThumbAutomationPeer.cs
- PingReply.cs
- ExtendLockCommand.cs
- Point.cs
- ApplicationId.cs
- RegexMatchCollection.cs
- Pointer.cs
- SectionInput.cs
- PtsHost.cs
- EllipticalNodeOperations.cs
- TextClipboardData.cs
- SafeRightsManagementQueryHandle.cs
- WorkflowInlining.cs
- OutKeywords.cs
- TimeSpanOrInfiniteConverter.cs
- WebPartTracker.cs
- SineEase.cs
- PropertyGroupDescription.cs
- EventSourceCreationData.cs
- OleDbRowUpdatedEvent.cs
- DateBoldEvent.cs
- ClientData.cs
- InProcStateClientManager.cs
- FontUnitConverter.cs
- RsaSecurityToken.cs
- Scripts.cs
- DbParameterHelper.cs
- Random.cs
- CodeVariableDeclarationStatement.cs
- IDispatchConstantAttribute.cs
- DataBindingExpressionBuilder.cs
- PinnedBufferMemoryStream.cs
- FrameDimension.cs
- RijndaelManagedTransform.cs
- TextBox.cs
- BinaryCommonClasses.cs
- AlphabeticalEnumConverter.cs
- DrawListViewSubItemEventArgs.cs
- AccessDataSource.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- CompilationPass2TaskInternal.cs
- LifetimeServices.cs
- Debug.cs
- ServerTooBusyException.cs
- BindingObserver.cs
- AtomMaterializerLog.cs
- PreloadHost.cs
- InteropEnvironment.cs
- DataSourceCache.cs
- RegexWriter.cs
- CompositeCollection.cs
- WebPartsPersonalizationAuthorization.cs
- LinkButton.cs
- WSSecurityXXX2005.cs
- UnknownBitmapDecoder.cs
- RadioButtonRenderer.cs
- Propagator.JoinPropagator.cs