简体   繁体   English

为什么我的属性在winforms编辑器中是只读的?

[英]Why is my property readonly in winforms editor?

My class A inherits a class B that inherits AxHost . 我的类A继承了类B该类B继承了AxHost

My property is shown as readonly with no attributes set that would enforce this behaviour. 我的属性显示为只读,未设置任何强制执行此行为的属性。

public int MyProperty { get; set; }

My property was missing a DispId Attribute. 我的媒体资源缺少DispId属性。

[System.Runtime.InteropServices.DispId(96859268)]
public int MyProperty { get; set; }

DispID must be unique across interfaces? DispID在各个接口上必须是唯一的吗?

Further questions: In my example, Class B does have some Properties tagged with DispId and some without, and those without are not affected by being readonly. 进一步的问题:在我的示例中,类B确实有一些用DispId标记的属性,而有些则没有,而没有的则不受只读影响。 If someone has an explanation for this, please share it. 如果有人对此有解释,请分享。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM