Codedom Codemembermethod.attribute public [英] Codedom Codemembermethod.attribute public

查看:36
本文介绍了Codedom Codemembermethod.attribute public的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 CodeMemberMethod.Attribute 中遇到问题当我选择public作为属性时,即使我没有初始化它,也会自动添加virtual属性。我怎么能消除虚拟属性?





I am having a problem in CodeMemberMethod.Attribute when I selected public as an attribute a "virtual" attribute is automatically added even if I dont initialize it. How am I able to eliminate the virtual attribute?

Is

public virtual int Update() {
        }





不同


different from

public int Update() {
        }



已添加代码块[/ Edit]


Code block added[/Edit]

推荐答案

这让我困惑了一段时间,我发现公共和最终属性都是必需的。一旦我知道了,MemberAttributes enum的文档就有意义了!



例如

This puzzled me for a while too and I discovered that both Public and Final attributes were required. Once I knew that, the documentation for the MemberAttributes enum made sense!

e.g.
method.Attributes = MemberAttributes.Public | MemberAttributes.Final;



Alan。


Alan.


非常感谢您的回答我真的很感激!现在我明白你必须完成声明的属性,这样才不会引起其他解释。
Thank you very much for the answer i really appreciate it! Now I understand that you have to finalize the declared attribute so that it will not cause other interpretation.


这篇关于Codedom Codemembermethod.attribute public的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆