如何将一个或多个属性应用于项目中的所有类?
如何将属性应用于特定项目中的所有类?! 仅将 CLSCompliant 属性应用于一个类就足够了,还是必须应用于所有类?
感谢您的回答...
How can I apply an attribute to all classes in a particular project?!
And is it enough to apply CLSCompliant attribute to just one class or do I have to apply to all classes?
Thanks for your answers...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是属性的声明:
注意 [AttributeUsage]。使用 AttributeTargets.All 表示该属性可以应用于任何内容。其中包括组件:
This is the declaration for the attribute:
Note the [AttributeUsage]. With AttributeTargets.All, it indicates that the attribute can be applied to anything. Which includes the assembly:
项目是一个程序集,因此您可以使用程序集属性。
A project is an assembly, so you could use an assembly attribute.