ExperimentalAttribute 类

定义

指示 API 是实验性的,并且将来可能会更改。

public ref class ExperimentalAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed class ExperimentalAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)>]
type ExperimentalAttribute = class
    inherit Attribute
Public NotInheritable Class ExperimentalAttribute
Inherits Attribute
继承
ExperimentalAttribute
属性

注解

ExperimentalAttribute 允许使用诊断来标记调用站点,该诊断指示使用了实验性功能。 可以使用此属性在其他稳定库中提供预览功能。

有关将 API 标记为预览的详细信息,请参阅 预览 API

构造函数

名称 说明
ExperimentalAttribute(String)

初始化类的新实例 ExperimentalAttribute ,指定编译器在报告应用属性的 API 时将使用的 ID。

属性

名称 说明
DiagnosticId

获取编译器在报告应用属性的 API 时将使用的 ID。

Message

获取或设置与实验属性关联的可选消息。

TypeId

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

(继承自 Attribute)
UrlFormat

获取或设置相应文档的 URL。 API 接受格式字符串而不是实际 URL,创建包含诊断 ID 的通用 URL。

方法

名称 说明
Equals(Object)

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

(继承自 Attribute)
GetHashCode()

返回此实例的哈希代码。

(继承自 Attribute)
GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

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

(继承自 Attribute)
Match(Object)

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅