IDReferencePropertyAttribute 类

定义

定义应用于包含 ID 引用的属性的属性。 此类不能被继承。

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

示例

下面的代码示例演示如何将 IDReferencePropertyAttribute 属性应用于计算结果为字符串的属性。 在此示例中,成员 DataSourceID 标识数据源控件,因此指定类型 DataSourceControl

// This class implements a custom data source control.
public class SomeDataBoundControl : DataBoundControl
{   
    [ IDReferencePropertyAttribute(typeof(DataSourceControl)) ]        
    new public string DataSourceID {
        get {
            return base.DataSourceID;
        }
        set {
            base.DataSourceID = value;
        }
    }
}
' This class implements a custom data source control.
Public Class SomeDataBoundControl
    Inherits DataBoundControl
    
    <IDReferencePropertyAttribute(GetType(DataSourceControl))>  _
    Public Shadows Property DataSourceID() As String 
        Get
            Return MyBase.DataSourceID
        End Get
        Set
            MyBase.DataSourceID = value
        End Set
    End Property
    
End Class

注解

IDReferencePropertyAttribute 类应用于包含 ID 引用的属性。 ContentPlaceHolderID 是包含 ID 引用的属性的示例。 应用此属性后,设计器可以在设计时提供其他功能,例如列出 ID。

构造函数

名称 说明
IDReferencePropertyAttribute()

初始化 IDReferencePropertyAttribute 类的新实例。

IDReferencePropertyAttribute(Type)

使用指定的类型初始化类的新实例 IDReferencePropertyAttribute

属性

名称 说明
ReferencedControlType

获取应用属性的属性所允许 IDReferencePropertyAttribute 的控件的类型。

TypeId

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)

方法

名称 说明
Equals(Object)

返回一个值,该值指示此实例是否等于指定对象。

GetHashCode()

返回此实例的哈希代码。

GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否为派生类的默认值。

(继承自 Attribute)
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)

适用于

另请参阅