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
- SqlSupersetValidator.cs
- Journal.cs
- DataSourceExpression.cs
- PartBasedPackageProperties.cs
- MessageBox.cs
- ProfilePropertySettings.cs
- MultilineStringConverter.cs
- Activity.cs
- SizeKeyFrameCollection.cs
- HwndSubclass.cs
- Queue.cs
- HistoryEventArgs.cs
- ProfileParameter.cs
- unitconverter.cs
- TextWriter.cs
- BitmapInitialize.cs
- ACE.cs
- WrappedIUnknown.cs
- DataRowChangeEvent.cs
- ViewValidator.cs
- DataGridParentRows.cs
- OdbcDataReader.cs
- ColorContext.cs
- PropertyChangingEventArgs.cs
- WebRequestModulesSection.cs
- SafeHandles.cs
- ToolStripSeparatorRenderEventArgs.cs
- XPathAncestorQuery.cs
- Soap12FormatExtensions.cs
- SqlClientPermission.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- ProcessProtocolHandler.cs
- StreamGeometryContext.cs
- FileIOPermission.cs
- NavigationExpr.cs
- DataGridTextBox.cs
- MatrixUtil.cs
- GroupDescription.cs
- MonthCalendarDesigner.cs
- SynthesizerStateChangedEventArgs.cs
- FrameworkPropertyMetadata.cs
- XPathQilFactory.cs
- BitmapMetadataEnumerator.cs
- ComplexTypeEmitter.cs
- NonSerializedAttribute.cs
- ControlHelper.cs
- ItemContainerProviderWrapper.cs
- RegexParser.cs
- ViewSimplifier.cs
- Double.cs
- ZipIOLocalFileBlock.cs
- CaseKeyBox.xaml.cs
- CreateUserWizardStep.cs
- FlowDocumentReader.cs
- ProfileGroupSettingsCollection.cs
- VisualTreeHelper.cs
- ValidatingPropertiesEventArgs.cs
- GraphicsPathIterator.cs
- BmpBitmapDecoder.cs
- DebugController.cs
- XmlCustomFormatter.cs
- DataGridViewCellCollection.cs
- ValuePatternIdentifiers.cs
- FunctionNode.cs
- MetadataArtifactLoaderComposite.cs
- SoapAttributes.cs
- XmlDataImplementation.cs
- TransportConfigurationTypeElementCollection.cs
- ActiveXHost.cs
- UdpDiscoveryEndpoint.cs
- dtdvalidator.cs
- DataGridViewButtonCell.cs
- ContextProperty.cs
- UnaryNode.cs
- DBSchemaTable.cs
- NTAccount.cs
- DebugControllerThread.cs
- CharAnimationUsingKeyFrames.cs
- SQLBoolean.cs
- RuntimeConfigLKG.cs
- GenericTypeParameterConverter.cs
- SoundPlayer.cs
- BackEase.cs
- BasicViewGenerator.cs
- SchemaNames.cs
- TokenFactoryCredential.cs
- JoinGraph.cs
- InvokeBinder.cs
- HttpServerVarsCollection.cs
- ExtractorMetadata.cs
- SafeNativeMethods.cs
- DataGridViewCellCancelEventArgs.cs
- TiffBitmapEncoder.cs
- ToolbarAUtomationPeer.cs
- FrameAutomationPeer.cs
- SQLInt64Storage.cs
- ToolStripSeparator.cs
- ReflectionTypeLoadException.cs
- ValueQuery.cs
- AdapterSwitches.cs