需要注意的是,'CLSCompliant' 特性默认值为 'true',即默认情况下,类型和成员是符合 CLS 规范的。因此,在大多数情况下,只需要在不符合 CLS 规范的类型或成员上显式地将 'CLSCompliant' 特性设置为 'false' 即可。 总之,'CLSCompliant' 属性是一个重要的工具,可以帮助开发人员确保他们编写的代码遵循 CLS 规范,从而...
需要注意的是,'CLSCompliant' 特性默认值为 'true',即默认情况下,类型和成员是符合 CLS 规范的。因此,在大多数情况下,只需要在不符合 CLS 规范的类型或成员上显式地将 'CLSCompliant' 特性设置为 'false' 即可。 总之,'CLSCompliant' 属性是一个重要的工具,可以帮助开发人员确保他们编写的代码遵循 CLS 规范,从而...
“CLS是编程语言设计者和类库设计者之间的一个约定” [ CLSCompliant(false)]publicvoidCreateItem(EnvDTE.DTE dte) {this.creator.CreateDataAccessTechnologyObject(this, dte); }
[CLSCompliant(false)] uintSystem.IConvertible.ToUInt32(IFormatProvider provider); 这是因为有的语言不支持UInt32类型。 再看看对UInt32反编译的结果,UInt32的声明: [Serializable, StructLayout(LayoutKind.Sequential),CLSCompliant(false)] public struct UInt32 : IComparable, IFormattable, IConvertible { } 什...
获取指示所指示的程序元素是否符合 CLS 的布尔值。 C# 复制 public bool IsCompliant { get; } 属性值 Boolean 如果程序元素符合 CLS,则为 true;否则为 false。 适用于 产品版本 .NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7 .NET Framework 1.1, ...
If an assembly is marked as CLS-compliant, any publicly exposed type in the assembly that is not CLS-compliant must be marked with CLSCompliantAttribute using a false argument. Similarly, if a class is marked as CLS-compliant, you must individually mark all members that are not CLS-compliant...
If an assembly is marked as CLS-compliant, any publicly exposed type in the assembly that is not CLS-compliant must be marked with CLSCompliantAttribute using a false argument. Similarly, if a class is marked as CLS-compliant, you must individually mark all members that are not CLS-compliant...
If an assembly is marked as CLS-compliant, any publicly exposed type in the assembly that is not CLS-compliant must be marked withCLSCompliantAttributeusing afalseargument. Similarly, if a class is marked as CLS-compliant, you must individually mark all members that are not CLS-compliant. All...
[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=false, Inherited=true)] public sealed class CLSCompliantAttribute : Attribute Inheritance Object Attribute CLSCompliantAttribute Attributes AttributeUsageAttribute Examples The following example applies a CLSCompliantAttribute to the entire assembly....
trueif the program element is CLS-compliant; otherwise,false. Applies to TuoteVersiot .NETCore 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 .NET Framework1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, ...