CS3016 - 使用 Prism 时我们如何解决这个问题? MEF 导出模块?
[assembly: CLSCompliant(true)]
//CS3016: Arrays as attribute arguments is not CLS-compliant.
[ModuleExport(typeof(ModuleA), DependsOnModuleNames = new [] { "ModuleB" })]
public class ModuleA : IModule { }
我唯一能想到的就是将类标记为 [CLSCompliant(false)]
,但我想知道是否有更好的方法来解决这个问题?
[assembly: CLSCompliant(true)]
//CS3016: Arrays as attribute arguments is not CLS-compliant.
[ModuleExport(typeof(ModuleA), DependsOnModuleNames = new [] { "ModuleB" })]
public class ModuleA : IModule { }
The only thing I can think of is to mark the class as [CLSCompliant(false)]
, but I was wondering if there is a better way to get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为解决方法,您可以实现自己的符合 CLS 的
ModuleExportAttribute
,它使用逗号分隔列表而不是字符串数组:用法:
As a workaround you can implement your own CLS compliant
ModuleExportAttribute
which uses a comma separated list instead of an string array:Usage: