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;
}
///
/// Indicates if the property is Filterable.
///
public bool Filterable {
get {
return _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;
}
///
/// Indicates if the property is Filterable.
///
public bool Filterable {
get {
return _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
- SystemBrushes.cs
- DataGridViewLayoutData.cs
- FtpCachePolicyElement.cs
- TraceLevelStore.cs
- ExtensionSimplifierMarkupObject.cs
- FolderBrowserDialog.cs
- GeometryDrawing.cs
- DefaultMemberAttribute.cs
- SemaphoreFullException.cs
- AsymmetricSignatureDeformatter.cs
- TableRow.cs
- ContentTextAutomationPeer.cs
- RayMeshGeometry3DHitTestResult.cs
- IssuanceTokenProviderState.cs
- TagMapInfo.cs
- PtsContext.cs
- FormatException.cs
- FormViewCommandEventArgs.cs
- ToolTipService.cs
- PropertyChangedEventArgs.cs
- DataGridColumnStyleMappingNameEditor.cs
- CheckBox.cs
- BindingsCollection.cs
- storepermissionattribute.cs
- TextFormatterImp.cs
- ColorAnimation.cs
- ObjectSecurity.cs
- NamespaceQuery.cs
- WebBrowserContainer.cs
- NonBatchDirectoryCompiler.cs
- CodeDirectiveCollection.cs
- RuleSettings.cs
- SHA512Managed.cs
- QilNode.cs
- NameSpaceExtractor.cs
- SiteMap.cs
- EmptyQuery.cs
- TimerElapsedEvenArgs.cs
- Single.cs
- OutputCacheSection.cs
- XamlContextStack.cs
- Lazy.cs
- EmptyEnumerator.cs
- EventPrivateKey.cs
- CreateRefExpr.cs
- PixelShader.cs
- MethodCallConverter.cs
- ObjectConverter.cs
- AsyncResult.cs
- SafeEventLogWriteHandle.cs
- TransactionTable.cs
- DictionaryTraceRecord.cs
- ScrollBarRenderer.cs
- ServiceSecurityAuditBehavior.cs
- DataGridViewToolTip.cs
- InternalCache.cs
- DefaultClaimSet.cs
- WebPartMenuStyle.cs
- Point3DCollection.cs
- AtlasWeb.Designer.cs
- DelimitedListTraceListener.cs
- cache.cs
- EventLogInformation.cs
- AuthorizationSection.cs
- controlskin.cs
- CreateUserErrorEventArgs.cs
- ADMembershipUser.cs
- XmlExceptionHelper.cs
- InternalResources.cs
- ConnectionsZone.cs
- BrowserDefinition.cs
- IIS7WorkerRequest.cs
- SpanIndex.cs
- SurrogateChar.cs
- WebPartPersonalization.cs
- XmlSchemaCompilationSettings.cs
- WebDescriptionAttribute.cs
- GrammarBuilderBase.cs
- DomainConstraint.cs
- CultureTableRecord.cs
- ClockController.cs
- Pkcs7Signer.cs
- ConfigurationCollectionAttribute.cs
- AuthorizationSection.cs
- TargetInvocationException.cs
- UserNameSecurityTokenProvider.cs
- OptimizedTemplateContent.cs
- DocumentSequenceHighlightLayer.cs
- ConfigXmlCDataSection.cs
- HuffmanTree.cs
- WebConfigurationHost.cs
- Ppl.cs
- Asn1IntegerConverter.cs
- DetailsViewPagerRow.cs
- BamlRecordWriter.cs
- WebPartTransformer.cs
- XPathNodeList.cs
- LinearKeyFrames.cs
- QuadraticBezierSegment.cs
- SecurityUtils.cs