Question about the word Attribute in attribute class names

  • Thread starter Thread starter KJ
  • Start date Start date
K

KJ

Hello All,

I am wondering about attributes: in the Framework, they all seem to end
in the word Attribute, for example, BindableAttribute. But when you use
them, you can either code Bindable(true) or BindableAttribute(true). I
don't know of any other classes that work this way. Is this a "magic"
behavior of attribute classes? What is the reasoning for this?
 
This is a feature of the C# compiler. If the attribute class ends with
"Attribute" (and it should, as per the naming guidelines), then you can use
it without the "Attribute" part at the end.

Hope this helps.
 
Thanks Nicholas.
This is a feature of the C# compiler. If the attribute class ends with
"Attribute" (and it should, as per the naming guidelines), then you can use
it without the "Attribute" part at the end.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

KJ said:
Hello All,

I am wondering about attributes: in the Framework, they all seem to end
in the word Attribute, for example, BindableAttribute. But when you use
them, you can either code Bindable(true) or BindableAttribute(true). I
don't know of any other classes that work this way. Is this a "magic"
behavior of attribute classes? What is the reasoning for this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top