TagNameAttribute 类

定义

提供强类型指标的标记信息。

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

示例

public class MyStrongTypeMetric
{
    [TagName("tag_name_as_per_some_convention1")]
    public string Name1 { get; set; }

    [TagName("tag_name_as_per_some_convention2")]
    public string Name2;
}

注解

此属性应用于指标类的字段或属性,以替代默认标记名称。 默认情况下,标记名称与相应的字段或属性相同。 可以使用此属性替代默认值并提供自定义标记名称。

构造函数

名称 说明
TagNameAttribute(String)

初始化 TagNameAttribute 类的新实例。

属性

名称 说明
Name

获取标记的名称。

适用于