Stats

40 Contributors: 2
2017-01-20
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

CLSCompliantAttribute

Download c# eBook

Syntax

  1. [assembly:CLSCompliant(true)]
  2. [CLSCompliant(true)]

Parameters

ConstructorParameter
CLSCompliantAttribute(Boolean)Initializes an instance of the CLSCompliantAttribute class with a Boolean value indicating whether the indicated program element is CLS-compliant.

Remarks

The Common Language Specification (CLS) is a set of base rules to which any language targeting the CLI(language which confirms the Common Language Infrastructure specifications) should confirm in order to interoperate with other CLS-compliant languages.

List of CLI languages

You should mark your assembly as CLSCompliant in most cases when you are distributing libraries. This attribute will guarantee you that your code will be usable by all CLS-compliant languages. This means that your code can be consumed by any language that can be compiled and run on CLR(Common Language Runtime)

When your assembly is marked with CLSCompliantAttribute, the compiler will check if your code violates any of CLS rules and return warning if it is needed.

Related Examples