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
- CheckBoxFlatAdapter.cs
- PseudoWebRequest.cs
- Stroke2.cs
- infer.cs
- MatrixTransform3D.cs
- AssociationSetEnd.cs
- ObsoleteAttribute.cs
- TransformationRules.cs
- BindingContext.cs
- ScrollContentPresenter.cs
- SequenceDesigner.xaml.cs
- ProxyGenerator.cs
- ComAwareEventInfo.cs
- DocumentDesigner.cs
- AppModelKnownContentFactory.cs
- MetaModel.cs
- RotateTransform3D.cs
- RectangleConverter.cs
- TreeBuilderBamlTranslator.cs
- JournalEntry.cs
- ByteStack.cs
- TypeDescriptor.cs
- Deserializer.cs
- GridViewRowPresenter.cs
- ObjectConverter.cs
- MulticastDelegate.cs
- CLRBindingWorker.cs
- StrongNameKeyPair.cs
- UrlAuthorizationModule.cs
- CachedFontFamily.cs
- StringArrayConverter.cs
- NumberEdit.cs
- Rotation3DAnimation.cs
- SerialPinChanges.cs
- ParameterDataSourceExpression.cs
- FileDialogPermission.cs
- Rectangle.cs
- ComponentEditorPage.cs
- ColorIndependentAnimationStorage.cs
- ListViewDeletedEventArgs.cs
- EditorZoneAutoFormat.cs
- EntityDataSourceState.cs
- Attributes.cs
- DataGridTemplateColumn.cs
- DynamicField.cs
- ButtonAutomationPeer.cs
- ProvideValueServiceProvider.cs
- HostingEnvironmentSection.cs
- Brushes.cs
- DataGridViewLayoutData.cs
- CodeDomComponentSerializationService.cs
- HttpRuntimeSection.cs
- LazyTextWriterCreator.cs
- EdmFunction.cs
- ObjectView.cs
- Assembly.cs
- AssemblyResourceLoader.cs
- XPathAxisIterator.cs
- CompilerTypeWithParams.cs
- AssemblyFilter.cs
- Point4D.cs
- HtmlHead.cs
- GeneralTransform3DTo2D.cs
- DbException.cs
- FormsAuthenticationModule.cs
- HtmlHistory.cs
- ContextMenuStrip.cs
- FigureParagraph.cs
- StoreItemCollection.cs
- InvalidOleVariantTypeException.cs
- XMLDiffLoader.cs
- WindowsImpersonationContext.cs
- PolicyDesigner.cs
- QEncodedStream.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- TripleDES.cs
- WizardPanel.cs
- AssemblyCacheEntry.cs
- PictureBox.cs
- WinInet.cs
- CustomAttributeFormatException.cs
- KeySplineConverter.cs
- NotificationContext.cs
- ContainerVisual.cs
- UIElementParaClient.cs
- RuleInfoComparer.cs
- RawStylusInput.cs
- ConstantExpression.cs
- InArgumentConverter.cs
- ContextStaticAttribute.cs
- ConfigsHelper.cs
- RegexCompilationInfo.cs
- ResXBuildProvider.cs
- MembershipValidatePasswordEventArgs.cs
- BitmapEffectDrawing.cs
- StringSorter.cs
- DoubleStorage.cs
- TaskFormBase.cs
- XmlSchemaProviderAttribute.cs
- HeaderUtility.cs