Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to apply an attribute to an inherited method and I'm wondering if there's a way to do that without needing to implement the method again in the derived class...

 

Here's an example of how I need to do it:

 

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?

  • *Experts*
Posted

I don't think it's possible.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...