Very often I began to notice this syntax:

[STAThread] 

What is it? Just some kind of identifier in square brackets on a separate line?
What is it used for?

1 answer 1

This is an attribute.

Attributes in C # represent special tools that allow embedding additional metadata into an assembly. Attributes can be applied both to the entire type (class, interface, etc.) and to its individual parts (method, property, etc.). The basis of the attributes is the System.Attribute class, from which all other attribute classes are derived.

  • Re-read the question of the vehicle, I do not think that it goes for the answer to the question asked. - LLENN
  • @LLENN is the most important part of the answer. And the purpose of a specific attribute is in the documentation. Is that a link to add. - rdorn