Yuriy
Yuriy

Reputation: 2691

What is word "property:" in Attribute

Could you explain me what does word "property:" mean?

[property: NotifyParentProperty( true )]
public string Filename
{
  get;
  set;
}

Upvotes: 11

Views: 144

Answers (1)

Botz3000
Botz3000

Reputation: 39600

It means that the Attribute is applied to the property.
In this specific case, it's redundant and could be left away.

This kind of element defines the Attribute Target and is mostly useful when the target can be ambiguous, such as the targets method and return. Visual Studio also generates Attributes using the target assembly in AssemblyInfo.cs which is a part of many project templates.

More Info and a list of possible Attribute Targets:
Disambiguating Attribute Targets (MSDN)

Upvotes: 7

Related Questions