System.CLSCompliantAttribute Class

public sealed class CLSCompliantAttribute : Attribute

Base Types

Object
  Attribute
    CLSCompliantAttribute

Assembly

mscorlib

Library

BCL

Summary

Indicates whether the target of the current attribute complies with the Common Language Specification (CLS).

Description

If no CLSCompliantAttribute is associated with a given assembly, that assembly is assumed not to be CLS-compliant.

A type is assumed to be CLS-compliant if and only if its enclosing type (for nested types) or assembly (for top-level types) is CLS-compliant. Other members (methods, fields, properties and events) are CLS-compliant if and only if the type in which they are defined is CLS-compliant.

[Note: The CLS is a subset of CLI features that is supported by a broad set of compliant languages and tools. CLS-compliant languages and tools are guaranteed to interoperate with other CLS-compliant languages and tools.

Because the CLS defines the rules for language interoperability, its rules apply only to "externally visible" items. The CLS assumes that language interoperability is important only across the assembly boundary - that is, within a single assembly there are no restrictions as to the programming techniques that are used. Thus, the CLS rules apply only to items that are visible outside of their defining assembly and have public, family, or family-or-assembly accessibility.

For more information on CLS compliance, see Partition I of the CLI Specification.

This attribute can be applied to any valid attribute target. For a complete list of valid targets, see AttributeTargets.

]

Attributes

AttributeUsageAttribute(AttributeTargets.All, AllowMultiple=false, Inherited=true)

See Also

System Namespace

Members

CLSCompliantAttribute Constructors

CLSCompliantAttribute Constructor

CLSCompliantAttribute Properties

CLSCompliantAttribute.IsCompliant Property


CLSCompliantAttribute Constructor

public CLSCompliantAttribute(bool isCompliant);

Summary

Constructs and initializes a new instance of the CLSCompliantAttribute class.

Parameters

isCompliant
true if the target of the new instance complies with the CLS; otherwise, false .

See Also

System.CLSCompliantAttribute Class, System Namespace

CLSCompliantAttribute.IsCompliant Property

public bool IsCompliant { get; }

Summary

Gets a Boolean indicating whether the target of the current instance is CLS-compliant.

Property Value

true if the target of the current instance complies with the CLS; otherwise, false .

Description

This property is read-only.

See Also

System.CLSCompliantAttribute Class, System Namespace