The part with the example is very badly phrased, to the point of incomprehensibility. I quote:
You can apply an attribute by adding it on the line before the declaration using a ClassAttribute and a FieldAttribute:
[Class]
class MyClass
{
[Field]
int myField;
}
No idea what ClassAttribute, FieldAttribute, [Class] and [Field] are, or what they do; I’ve searched Microsoft’s documentation and found nothing. This really needs to be better explained.
1 Like
That concept is five years old so things may have shifted in the C# docs. I think [Class] and [Field] are intended to indicate where the attributes would go for the class or field. They’re not actual attributes. I suspect ClassAttribute and FieldAttribute are arbitrary generic names as well to avoid introducing more complexity by using actual attributes.
All in all, it does seem worthwhile to me for us to update the docs, but we’ll see what the maintainer thinks.