HelpKeywordAttribute 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为类或成员指定上下文关键字。 此类不能被继承。
public ref class HelpKeywordAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=false, Inherited=false)]
public sealed class HelpKeywordAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=false, Inherited=false)]
[System.Serializable]
public sealed class HelpKeywordAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=false, Inherited=false)>]
type HelpKeywordAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=false, Inherited=false)>]
[<System.Serializable>]
type HelpKeywordAttribute = class
inherit Attribute
Public NotInheritable Class HelpKeywordAttribute
Inherits Attribute
- 继承
- 属性
下面的代码示例演示如何通过将 属性放置在 成员本身上来替代此帮助系统行为。 这些是以下类的关键字,称为 DemoComponent
:
类关键字 (keyword) :“
System.ComponentModel.Component
” (DemoNamespace.DemoComponent
)Property1 关键字 (keyword) :“”
DemoNamespace.DemoComponent.Property1
(默认)Property2 关键字 (keyword) :“
SomeNamespace.SomeOtherClass.Property2
” (DemoNamespace.DemoComponent.Property2
)
[HelpKeywordAttribute(typeof(Component))]
public class DemoComponent : Component
{
public string Property1
{
get
{
return "";
}
}
[HelpKeywordAttribute("SomeNamespace.SomeOtherClass.Property2")]
public string Property2
{
get
{
return "";
}
}
}
下面的代码示例演示如何使用 HelpKeywordAttribute 类指定上下文关键字 (keyword) 。 有关此代码示例的完整说明,请参阅如何:在Windows 窗体控件中应用属性。
// This control demonstrates a simple logging capability.
[ComplexBindingProperties("DataSource", "DataMember")]
[DefaultBindingProperty("TitleText")]
[DefaultEvent("ThresholdExceeded")]
[DefaultProperty("Threshold")]
[HelpKeywordAttribute(typeof(UserControl))]
[ToolboxItem("System.Windows.Forms.Design.AutoSizeToolboxItem,System.Design")]
public class AttributesDemoControl : UserControl
{
' This control demonstrates a simple logging capability.
<ComplexBindingProperties("DataSource", "DataMember"), _
DefaultBindingProperty("TitleText"), _
DefaultEvent("ThresholdExceeded"), _
DefaultProperty("Threshold"), _
HelpKeywordAttribute(GetType(UserControl)), _
ToolboxItem("System.Windows.Forms.Design.AutoSizeToolboxItem,System.Design")> _
Public Class AttributesDemoControl
Inherits UserControl
默认情况下,类的帮助关键字 (keyword) 由 Type.FullName 属性值提供。 对于成员,帮助关键字 (keyword) 由声明属性的类型的完整名称加上属性名称本身提供。
例如,考虑 Control.Text 控件上的 System.Windows.Forms.Button 属性。 类关键字 (keyword) 为“System.Windows.Forms。Button“,但Control.Text关键字 (keyword) 属性为”System.Windows.Forms。Control.Text“,因为 Control.Text 属性是在 类上System.Windows.Forms.Control声明的,而不是System.Windows.Forms.Button类本身;System.Windows.Forms.Button类继承 属性。
相比之下,属性Button.DialogResult在 类上System.Windows.Forms.Button声明,因此其关键字 (keyword) 为“System.Windows.Forms。Button.DialogResult”。
当帮助系统获取关键字时,它将首先查看 HelpKeywordAttribute。 在类级别,它将返回 指定的 HelpKeywordAttribute字符串。 这不会用于所讨论类型的成员,该类型仍将反映声明类型的实际全名以及成员名称。 此属性支持强类型类,这些类具有关联的通用文档,但不同的帮助 ID。
Help |
初始化 HelpKeywordAttribute 类的新实例。 |
Help |
初始化 HelpKeywordAttribute 类的新实例。 |
Help |
初始化给定类型的 HelpKeywordAttribute 类的新实例。 |
Default |
表示 HelpKeywordAttribute 的默认值。 此字段为只读。 |
Help |
获取此属性提供的帮助关键字。 |
Type |
在派生类中实现时,获取此 Attribute 的唯一标识符。 (继承自 Attribute) |
Equals(Object) |
确定两个 HelpKeywordAttribute 实例是否相等。 |
Get |
返回此实例的哈希代码。 |
Get |
获取当前实例的 Type。 (继承自 Object) |
Is |
确定“帮助”关键字是否为 |
Match(Object) |
当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 (继承自 Attribute) |
Memberwise |
创建当前 Object 的浅表副本。 (继承自 Object) |
To |
返回表示当前对象的字符串。 (继承自 Object) |
_Attribute. |
将一组名称映射为对应的一组调度标识符。 (继承自 Attribute) |
_Attribute. |
检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 (继承自 Attribute) |
_Attribute. |
检索对象提供的类型信息接口的数量(0 或 1)。 (继承自 Attribute) |
_Attribute. |
提供对某一对象公开的属性和方法的访问。 (继承自 Attribute) |
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |