プロパティの継承された属性をオーバーライドすることについて、細かい質問があります。
次の属性があるとします。
[AttributeUsage(AttributeTargets.All, Inherited = true)]
public class MyAttributeAttribute : Attribute
//...
public class ParentClass
{
[MyAttribute]
public String MyString;
}
public class ChildClass : ParentClass
{
new public String MyString; //Doesn't have MyAttribute
}
しかしMyAttribute
、 がクラスに設定されている場合はどうなるでしょうか。
[MyAttribute]
public class ParentClass
public class ChildClass; //Don't want MyAttribute
ChildClass が属性を継承しないようにする方法はありますか?
コンテキスト: 純粋に理論的です。属性を継承可能にしたいのですが、いつかそのようなことが起こった場合、それをオーバーライドできるかどうかを知りたいです。