如何将属性应用于特定项目中的所有类?是否足以将CLSCompliant属性应用于一个类,或者我必须适用于所有课程?

感谢您的回答...

有帮助吗?

解决方案

这是属性的声明:

[SerializableAttribute]
[ComVisibleAttribute(true)]
[AttributeUsageAttribute(AttributeTargets.All, Inherited = true, AllowMultiple = false)]
public sealed class CLSCompliantAttribute : Attribute

注意[attributeusage]。使用attributetargets.all,它表明该属性可以应用于任何东西。其中包括大会:

[assembly:CLSCompliant(true)]

其他提示

一个项目是一个集会,因此您可以使用 汇编属性.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top