[property: Obsolete]
static int X
{
get { return 42; }
}
In the code above, what purpose does the word "property" serve? The code seems to work the same way if I replace [property: Obsolete] with [Obsolete]. And although "property" is coloured blue in Visual Studio, it does not appear in the list of C# keywords: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
The Attribute specification defines this as an
attribute target
.It also states that in many cases, like the one you mention, it is permitted but not necessary.