Rajaat
Member
I want to apply an attribute to an inherited method and Im wondering if theres a way to do that without needing to implement the method again in the derived class...
Heres an example of how I need to do it:
I would like to avoid providing a new implementation for MethodA() but somehow apply the attribute in the derived class.... I know if I apply the attribute in the base class then the derived class will inherit the attribute but I want to give the derived class the ability to decide who should get the attribute.
Any ideas?
Heres an example of how I need to do it:
Code:
namespace X
{
public class Base
{
public void MethodA()
{
// implementation
}
}
public class Derived : Base
{
[AttributeToApply]
public new void MethodA()
{
base.MethodA();
}
}
}
I would like to avoid providing a new implementation for MethodA() but somehow apply the attribute in the derived class.... I know if I apply the attribute in the base class then the derived class will inherit the attribute but I want to give the derived class the ability to decide who should get the attribute.
Any ideas?