Multiple choice technology web 2.0

In order for an attribute to be Common Language Specification (CLS) compliant, it must follow which one of the following rules?

  1. It must inherit directly or indirectly from System.Attribute

  2. It must be defined in the System.Attribute namespace

  3. It must have the AttributeUsageAttribute applied to its class.

  4. It must only be applied to a selected type once

  5. It must be applied only at the assembly level.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

For an attribute class to be CLS-compliant, it must have the System.AttributeUsageAttribute applied to define its usage constraints. While inheriting from System.Attribute is required to define any custom attribute in .NET, applying AttributeUsageAttribute is the specific rule for CLS compliance.