本文介绍了这是什么意思把DataMemberAttribute接口成员吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是什么意思把一个 DataMemberAttribute 一>接口成员吗?
这将如何影响派生类?
What does it mean to put a DataMemberAttribute on an interface member?How does this affect derived classes?
推荐答案
如下面的签名中显示的数据成员属性是不可继承
As shown in the following signature, the DataMember attribute is not inheritable
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, Inherited = false,
AllowMultiple = false)]
public sealed class DataMemberAttribute : Attribute
因此,这让很少的意义来装饰接口成员具有这种属性你将有装饰的实现类与此属性过于成员。
Therefore, it makes very little sense to decorate interface members with this attribute as you will have to decorate the implementing classes' members with this attribute too.
这篇关于这是什么意思把DataMemberAttribute接口成员吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!