属性上的Inherited布尔属性指的是什么?
这是否意味着,如果我使用属性AbcAtribute (具有Inherited = true)定义我的类,并且如果我从该类继承另一个类,那么派生类也将应用相同的属性?
要通过代码示例来阐明此问题,请设想以下内容:
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public class Random: Attribute
{ /* attribute logic here */ }
[Random]
class Mother
{ }
class Child : Mother
{ }Child是否也应用了Random属性?
https://stackoverflow.com/questions/1240960
复制相似问题