static in attributes

N

Nicholas Paldino [.NET/C# MVP]

Pohihihi,

Attributes can have static methods/properties, just like any other
class. However, you have to remember that a static method/property on an
attribute will not be applicable to the type, but rather, all types.

Hope this helps.
 
P

Pohihihi

Actually I am not understanding what you mean by
attribute will not be applicable to the type, but rather, all types

you mean it will behave like
[AttributeUsage(AttributeTargets.All)]

??

Thanks,
Po

Nicholas Paldino said:
Pohihihi,

Attributes can have static methods/properties, just like any other
class. However, you have to remember that a static method/property on an
attribute will not be applicable to the type, but rather, all types.

Hope this helps.


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

Pohihihi said:
In what condition attributes (class) might have static methods?
 

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

Top