在C#中,attributes(特性)通常遵循以下命名规范:
Attribute类的名称应以Attribute结尾,例如:[Serializable]Attribute类的名称应使用PascalCase(首字母大写)命名规范Attribute类的属性应使用PascalCase命名规范Attribute类的属性值应使用小写字母开头的camelCase命名规范下面是一个示例:
[Serializable]public class MyClass{ [JsonProperty("Id")] public int id { get; set; } [Range(1, 100)] public int Value { get; set; }}在这个示例中,Serializable、JsonProperty和Range都是预定义的Attribute,它们遵循了上述的命名规范。同时,MyClass类中的属性id和Value也分别使用了JsonProperty和Range这两个Attribute。


