FilterableAttribute 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定要向其应用特性的属性是否支持设备筛选。 此类不能被继承。
public ref class FilterableAttribute sealed : Attribute[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)]
public sealed class FilterableAttribute : Attribute[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)>]
type FilterableAttribute = class
    inherit AttributePublic NotInheritable Class FilterableAttribute
Inherits Attribute- 继承
- 属性
示例
下面的代码示例演示如何将 属性应用于 FilterableAttribute 自定义控件的属性,以指示 属性不支持设备筛选。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Samples.AspNet.CS.Controls
{
    public class SimpleCustomControl : WebControl
    {
        private string _productID;
        // Set Filterable attribute to specify that this
        // property does not support device filtering.
        [Bindable(true)]
        [Filterable(false)]
        public string ProductID
        {
            get
            {
                return _productID;
            }
            set
            {
                _productID = value;
            }
        }
    }
}
Imports System.ComponentModel
Imports System.Web.UI
Namespace Samples.AspNet.VB.Controls
    Public Class SimpleCustomControl
        Inherits System.Web.UI.WebControls.WebControl
        Dim _productID As String
        ' Set Filterable attribute to specify that this
        ' property does not support device filtering.
        <Bindable(True), Filterable(False)> Property ProductID() As String
            Get
                Return _productID
            End Get
            Set(ByVal Value As String)
                _productID = Value
            End Set
        End Property
    End Class
End Namespace
注解
属性 FilterableAttribute 应用于 属性以指定属性是否支持设备筛选。 当属性支持设备筛选时,可以通过指定设备筛选器来替代特定设备的属性的值。 默认情况下,属性是可筛选的,因此控件开发人员可以通过将 属性设置为 FilterableAttributefalse来阻止对属性进行设备筛选。 有关详细信息,请参阅 针对特定设备进行自定义。
有关使用特性的详细信息,请参阅 特性。
有关 FilterableAttribute 类的实例的初始属性值列表,请参见 FilterableAttribute 构造函数。
构造函数
| FilterableAttribute(Boolean) | 初始化 FilterableAttribute 类的新实例。 | 
字段
| Default | 以默认属性设置表示预定义 FilterableAttribute 对象。 此字段为只读。 | 
| No | 表示一个预定义 FilterableAttribute 对象,用于指示属性不支持设备筛选。 此字段为只读。 | 
| Yes | 表示一个预定义 FilterableAttribute 对象,用于指示属性支持设备筛选。 此字段为只读。 | 
属性
| Filterable | 获取一个值,该值指示向其应用 FilterableAttribute 特性的属性是否支持设备筛选。 | 
| TypeId | 在派生类中实现时,获取此 Attribute 的唯一标识符。(继承自 Attribute) | 
方法
| Equals(Object) | 确定 FilterableAttribute 类的当前实例是否等于指定的对象。 | 
| GetHashCode() | 返回此实例的哈希代码。 | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| IsDefaultAttribute() | 确定 FilterableAttribute 类的当前实例是否等于 Default 特性。 | 
| IsObjectFilterable(Object) | 确定指定的 Object 是否支持设备筛选。 | 
| IsPropertyFilterable(PropertyDescriptor) | 确定属性是否支持设备筛选。 | 
| IsTypeFilterable(Type) | 确定指定的数据类型是否支持设备筛选。 | 
| Match(Object) | 当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。(继承自 Attribute) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) | 
显式接口实现
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) | 将一组名称映射为对应的一组调度标识符。(继承自 Attribute) | 
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) | 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。(继承自 Attribute) | 
| _Attribute.GetTypeInfoCount(UInt32) | 检索对象提供的类型信息接口的数量(0 或 1)。(继承自 Attribute) | 
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | 提供对某一对象公开的属性和方法的访问。(继承自 Attribute) |