使用TypeBuilder/propertyBuilder定义无效的参考类型属性
我正在使用TypeBuilder和PropertyBuilder在运行时创建类型(.NET 6)。
我需要指定我的属性具有无效的参考类型: 公共myReferenceType? myproperty {get;放; }
我发现编译器正在使用自定义属性的“ system.runtime.compilerServices.pilerServices.nullableAttribute”在引擎盖下进行操作,但是看来此属性也是在编译时创建的,并且它不存在其他地方,我可以添加的地方。它可以到我新创建的属性。
有人知道我们该怎么做吗?
I'm using TypeBuilder and PropertyBuilder to create Types at runtime (.NET 6).
I need to specify that my property has a nullable reference type:
public MyReferenceType? MyProperty { get; set; }
I have found that the compiler is doing it under the hood with a custom attribute "System.Runtime.CompilerServices.NullableAttribute" but it seems that this attribute is also created at compile time and it does not exist somewhere else where I can just add it to my newly created property.
Does someone know how can we do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论