Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PeerTransportListenAddressValidator.cs
- ListBoxItemWrapperAutomationPeer.cs
- RightsManagementErrorHandler.cs
- BindingListCollectionView.cs
- WeakHashtable.cs
- Activity.cs
- Profiler.cs
- ProxyOperationRuntime.cs
- SmtpAuthenticationManager.cs
- EdmSchemaAttribute.cs
- CodeSnippetExpression.cs
- PackageRelationshipSelector.cs
- Touch.cs
- NodeInfo.cs
- CheckBox.cs
- XmlNodeList.cs
- StrokeRenderer.cs
- _NestedMultipleAsyncResult.cs
- ScaleTransform.cs
- CollectionTypeElement.cs
- TdsParser.cs
- ChangePassword.cs
- AbstractDataSvcMapFileLoader.cs
- DataGridColumnCollection.cs
- ParameterBuilder.cs
- SynchronizedInputProviderWrapper.cs
- WorkflowMarkupSerializer.cs
- RtfToken.cs
- XmlDataDocument.cs
- Int32Collection.cs
- SchemaCollectionCompiler.cs
- IsolatedStorageException.cs
- XamlValidatingReader.cs
- DesignSurface.cs
- OpenTypeLayoutCache.cs
- ListViewInsertedEventArgs.cs
- Point4DValueSerializer.cs
- GiveFeedbackEventArgs.cs
- XmlRawWriterWrapper.cs
- HttpServerVarsCollection.cs
- QueueSurrogate.cs
- NamespaceCollection.cs
- ParameterModifier.cs
- DependencyProperty.cs
- DataGridViewRow.cs
- ManagedWndProcTracker.cs
- ControlIdConverter.cs
- ResourceReader.cs
- GcHandle.cs
- ReflectEventDescriptor.cs
- XmlSchemaInfo.cs
- SQLSingle.cs
- InvalidPrinterException.cs
- WindowsIdentity.cs
- ButtonChrome.cs
- DataSourceCache.cs
- StateDesigner.CommentLayoutGlyph.cs
- BindableAttribute.cs
- BamlLocalizableResourceKey.cs
- RSACryptoServiceProvider.cs
- BrowserCapabilitiesCodeGenerator.cs
- CheckedPointers.cs
- AudioFormatConverter.cs
- BuilderPropertyEntry.cs
- ReliabilityContractAttribute.cs
- XmlSchemaInferenceException.cs
- x509utils.cs
- CustomAttributeFormatException.cs
- SortAction.cs
- ForeignKeyFactory.cs
- ResourceAttributes.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- ControlsConfig.cs
- AssemblyAttributes.cs
- BinaryKeyIdentifierClause.cs
- WebPartConnectionsConnectVerb.cs
- Renderer.cs
- CounterSample.cs
- DBAsyncResult.cs
- XmlWriter.cs
- DataBinder.cs
- DropShadowBitmapEffect.cs
- DataBindingCollection.cs
- SByte.cs
- MetabaseServerConfig.cs
- PathData.cs
- SpecialNameAttribute.cs
- TreeNodeBinding.cs
- ByteStreamMessageEncoderFactory.cs
- TextElementEnumerator.cs
- SlipBehavior.cs
- _ProxyRegBlob.cs
- TreeNodeClickEventArgs.cs
- XmlnsDictionary.cs
- RegisteredScript.cs
- RequestUriProcessor.cs
- SafeHandle.cs
- EditorBrowsableAttribute.cs
- ApplicationCommands.cs
- SqlBulkCopyColumnMapping.cs