相关疑难解决方法(0)

继承如何为Attributes工作?

Inherited属性上的bool属性是指什么?

这是否意味着如果我使用属性AbcAtribute(有Inherited = true)定义我的类,并且如果我从该类继承另一个类,那么派生类也将应用相同的属性?

要使用代码示例澄清此问题,请想象以下内容:

[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public class Random: Attribute
{ /* attribute logic here */ }

[Random]
class Mother 
{ }

class Child : Mother 
{ }
Run Code Online (Sandbox Code Playgroud)

是否ChildRandom应用了属性?

.net c# vb.net attributes

103
推荐指数
2
解决办法
5万
查看次数

标签 统计

.net ×1

attributes ×1

c# ×1

vb.net ×1