Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / System / ComponentModel / PropertyFilterAttribute.cs / 1 / PropertyFilterAttribute.cs
namespace System.ComponentModel { using System; using System.Diagnostics.CodeAnalysis; ////// This attribute is a "query" attribute. It is /// an attribute that causes the type description provider /// to narrow the scope of returned properties. It differs /// from normal attributes in that it cannot actually be /// placed on a class as metadata and that the filter mechanism /// is code rather than static metadata. /// [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] public sealed class PropertyFilterAttribute : Attribute { //------------------------------------------------------ // // Constructors // //----------------------------------------------------- #region Constructors ////// Creates a new attribute. /// public PropertyFilterAttribute(PropertyFilterOptions filter) { _filter = filter; } #endregion Constructors //----------------------------------------------------- // // Public Methods // //----------------------------------------------------- #region Public Methods ////// Override of Object.Equals that returns true if the filters /// contained in both attributes match. /// public override bool Equals(object value) { PropertyFilterAttribute a = value as PropertyFilterAttribute; if (a != null && a._filter.Equals(_filter)) { return true; } return false; } ////// Override of Object.GetHashCode. /// public override int GetHashCode() { return _filter.GetHashCode(); } ////// Match determines if one attribute "matches" another. For /// attributes that store flags, a match may be different from /// an equals. For example, a filter of SetValid matches a /// filter of All, because All is a merge of all filter values. /// public override bool Match(object value) { PropertyFilterAttribute a = value as PropertyFilterAttribute; if (a == null) return false; return ((_filter & a._filter) == _filter); } #endregion Public Methods //------------------------------------------------------ // // Public Operators // //----------------------------------------------------- //------------------------------------------------------ // // Public Properties // //------------------------------------------------------ #region Public Properties ////// The filter value passed into the constructor. /// public PropertyFilterOptions Filter { get { return _filter; } } #endregion Public Properties //----------------------------------------------------- // // Public Events // //------------------------------------------------------ //----------------------------------------------------- // // Public Fields // //----------------------------------------------------- #region Public Fields ////// Attributes may declare a Default field that indicates /// what should be done if the attribute is not defined. /// Our default is to return all properties. /// [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly PropertyFilterAttribute Default = new PropertyFilterAttribute(PropertyFilterOptions.All); #endregion Public Fields //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields private PropertyFilterOptions _filter; #endregion Private Fields } } // 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
- DataSourceCacheDurationConverter.cs
- HttpServerUtilityWrapper.cs
- TrustSection.cs
- Int32AnimationBase.cs
- ProtocolsConfigurationEntry.cs
- pingexception.cs
- GPRECT.cs
- ControlTemplate.cs
- SHA1Managed.cs
- SystemColors.cs
- Item.cs
- ObjectStateManagerMetadata.cs
- DecimalAnimation.cs
- RedirectionProxy.cs
- ContentFileHelper.cs
- X509ScopedServiceCertificateElement.cs
- CreateRefExpr.cs
- ProcessThread.cs
- Misc.cs
- PolyBezierSegment.cs
- CustomErrorCollection.cs
- CodeConstructor.cs
- ProfessionalColorTable.cs
- WebCategoryAttribute.cs
- Timeline.cs
- BatchServiceHost.cs
- XmlSchemaDocumentation.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- DataKeyCollection.cs
- RangeValidator.cs
- LinearGradientBrush.cs
- DataGridViewComboBoxEditingControl.cs
- MobileControlPersister.cs
- DefaultHttpHandler.cs
- ValidatedControlConverter.cs
- ProcessThreadCollection.cs
- StateDesigner.LayoutSelectionGlyph.cs
- XmlNamespaceMappingCollection.cs
- BamlRecordHelper.cs
- NavigationPropertySingletonExpression.cs
- MobileFormsAuthentication.cs
- FileDialog.cs
- SuppressMergeCheckAttribute.cs
- CompensatableSequenceActivity.cs
- WebPartMinimizeVerb.cs
- EntityDataSourceWrapperCollection.cs
- ValidationContext.cs
- TimerEventSubscription.cs
- InputMethodStateTypeInfo.cs
- QilFactory.cs
- SqlTopReducer.cs
- SystemIcmpV6Statistics.cs
- ClearTypeHintValidation.cs
- SymDocumentType.cs
- VerticalAlignConverter.cs
- SingleTagSectionHandler.cs
- EventBindingService.cs
- SamlConstants.cs
- SelectiveScrollingGrid.cs
- TreeNodeCollection.cs
- ControlCollection.cs
- RelationshipEndMember.cs
- XmlAtomicValue.cs
- SizeF.cs
- XmlAnyAttributeAttribute.cs
- Point3DKeyFrameCollection.cs
- CounterCreationDataCollection.cs
- AssemblyBuilder.cs
- ISessionStateStore.cs
- CalloutQueueItem.cs
- _FixedSizeReader.cs
- XmlEventCache.cs
- VersionedStream.cs
- altserialization.cs
- HttpChannelHelper.cs
- CapabilitiesRule.cs
- KnownTypeAttribute.cs
- NullableBoolConverter.cs
- WsdlBuildProvider.cs
- ClaimTypeElement.cs
- ListViewDeleteEventArgs.cs
- AppDomain.cs
- WebPartEditorCancelVerb.cs
- VisualStyleTypesAndProperties.cs
- SimpleTypeResolver.cs
- ListItemsPage.cs
- DoubleConverter.cs
- KeyboardDevice.cs
- DataSourceSelectArguments.cs
- NameValueConfigurationElement.cs
- SetterBaseCollection.cs
- DataContractJsonSerializer.cs
- DataGridSortCommandEventArgs.cs
- Point.cs
- OleDbInfoMessageEvent.cs
- DataColumnChangeEvent.cs
- GPRECT.cs
- StateBag.cs
- CustomPopupPlacement.cs
- DependencyPropertyKind.cs