Reputation: 1648
So I'm coming over from Java, and I've been seeing (and using), a ton of these:
["foo bar"]
void method(param params)
{
..code things
}
Can someone explain to me what they are? I don't even know what they're called, so I can't manage to figure it out from documentation.
Upvotes: -1
Views: 523
Reputation: 5841
They are attributes. You can use them to decorate your code. The libraries providing the attributes usually use reflection to get this decorated (meta) information from your code at runtime.
For example, the XmlSerializer
uses them a lot.
Upvotes: 2
Reputation: 100381
They are called Attributes
.
There are many uses, such as:
and so on.
Upvotes: 2
Reputation: 1820
They are called .NET Attributes. You can read about it for example here: What are attributes in .NET?
Upvotes: 2