Forcing attributes

S

Sgt. Sausage

Question from experienced programmer, but C# newbie:

Can I force the application of an attribute -- to be detected at
compile time?

I've got some J. Random Interface:

interface IRandomInterface {

void Method1();
void Method2();

}

Is there any way that I can force an object that implements
this interface to be decorated with a custom attribute of a
specific type. Not just the class, but on the method level
too -- can I force the implementor of the interface to decorate
both the class and the methods with an attribute of a particular
(custom) type -- and have the compliler catch it if a required
attribute is missing?

Thanks in advance.
 
M

Mattias Sjögren

Is there any way that I can force an object that implements
this interface to be decorated with a custom attribute of a
specific type. Not just the class, but on the method level
too -- can I force the implementor of the interface to decorate
both the class and the methods with an attribute of a particular
(custom) type -- and have the compliler catch it if a required
attribute is missing?


No you can't.



Mattias
 

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