Forcing attributes

  • Thread starter Thread starter Sgt. Sausage
  • Start date Start date
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.
 
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
 
Back
Top