FilterableAttribute 类

定义

指定要向其应用特性的属性是否支持设备筛选。Specifies whether the property to which the attribute is applied supports device filtering. 此类不能被继承。This class cannot be inherited.

public ref class FilterableAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)]
public sealed class FilterableAttribute : Attribute
type FilterableAttribute = class
    inherit Attribute
Public NotInheritable Class FilterableAttribute
Inherits Attribute
继承
FilterableAttribute
属性

示例

下面的代码示例演示如何将FilterableAttribute特性应用于自定义控件的属性, 以指示该属性不支持设备筛选。The following code example demonstrates how to apply a FilterableAttribute attribute to a property of a custom control to indicate that the property does not support device filtering.


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特性应用于属性, 以指定属性是否支持设备筛选。The FilterableAttribute attribute is applied to a property to specify whether the property supports device filtering. 如果属性支持设备筛选, 则可以通过指定设备筛选器来覆盖特定设备的属性值。When a property supports device filtering, you can override the value of a property for a specific device by specifying a device filter. 默认情况下, 属性可筛选, 因此控件开发人员可以通过将属性设置FilterableAttribute为来false阻止对属性进行设备筛选。By default, properties are filterable, so a control developer could prevent device filtering on a property by setting the FilterableAttribute attribute to false. 有关详细信息, 请参阅针对特定设备进行自定义For more information, see Customizing for Specific Devices.

有关使用特性的详细信息, 请参阅特性For more information about using attributes, see Attributes.

有关 FilterableAttribute 类的实例的初始属性值列表,请参见 FilterableAttribute 构造函数。For a list of initial property values for an instance of the FilterableAttribute class, see the FilterableAttribute constructor.

构造函数

FilterableAttribute(Boolean)

初始化 FilterableAttribute 类的新实例。Initializes a new instance of the FilterableAttribute class.

字段

Default

以默认属性设置表示预定义 FilterableAttribute 对象。Represents a predefined FilterableAttribute object with default property settings. 此字段为只读。This field is read-only.

No

表示一个预定义 FilterableAttribute 对象,用于指示属性不支持设备筛选。Represents a predefined FilterableAttribute object that indicates that a property does not support device filtering. 此字段为只读。This field is read-only.

Yes

表示一个预定义 FilterableAttribute 对象,用于指示属性支持设备筛选。Represents a predefined FilterableAttribute object that indicates that a property supports device filtering. 此字段为只读。This field is read-only.

属性

Filterable

获取一个值,该值指示向其应用 FilterableAttribute 特性的属性是否支持设备筛选。Gets a value indicating whether the property to which the FilterableAttribute attribute is applied supports device filtering.

TypeId

在派生类中实现时,获取此 Attribute 的唯一标识符。When implemented in a derived class, gets a unique identifier for this Attribute.

(继承自 Attribute)

方法

Equals(Object)

确定 FilterableAttribute 类的当前实例是否等于指定的对象。Determines whether the current instance of the FilterableAttribute class is equal to the specified object.

GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
IsDefaultAttribute()

确定 FilterableAttribute 类的当前实例是否等于 Default 特性。Determines whether the current instance of the FilterableAttribute class is equal to the Default attribute.

IsObjectFilterable(Object)

确定指定的 Object 是否支持设备筛选。Determines whether the specified Object supports device filtering.

IsPropertyFilterable(PropertyDescriptor)

确定属性是否支持设备筛选。Determines whether a property supports device filtering.

IsTypeFilterable(Type)

确定指定的数据类型是否支持设备筛选。Determines whether the specified data type supports device filtering.

Match(Object)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(继承自 Attribute)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(继承自 Attribute)

适用于

另请参阅