为什么 Inherited AttributeUsage 对于 DataContractAttribute 是假的?



当我阅读DataContractAttribute源代码时,我注意到AttributeUsage中的Inherit=false。有人知道为什么需要将继承设置为 false?

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
public sealed class DataContractAttribute : Attribute

"继承的属性指示从应用属性的类派生的类是否可以继承属性。此属性采用真(默认值(或假标志。 https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/84c42s56(v=vs.100(

相关内容

  • 没有找到相关文章

最新更新