.NET Framework Class Library
ContractClassAttribute Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Specifies that a separate type contains the code contracts for this type.

Namespace:  System.Diagnostics.Contracts
Assembly:  mscorlib (in mscorlib.dll)
Syntax

Visual Basic (Declaration)
<ConditionalAttribute("CONTRACTS_FULL")> _
<ConditionalAttribute("DEBUG")> _
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface Or AttributeTargets.Delegate, AllowMultiple := False,  _
    Inherited := False)> _
Public NotInheritable Class ContractClassAttribute _
    Inherits Attribute
Visual Basic (Usage)
Dim instance As ContractClassAttribute
C#
[ConditionalAttribute("CONTRACTS_FULL")]
[ConditionalAttribute("DEBUG")]
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface|AttributeTargets.Delegate, AllowMultiple = false, 
    Inherited = false)]
public sealed class ContractClassAttribute : Attribute
Visual C++
[ConditionalAttribute(L"CONTRACTS_FULL")]
[ConditionalAttribute(L"DEBUG")]
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface|AttributeTargets::Delegate, AllowMultiple = false, 
    Inherited = false)]
public ref class ContractClassAttribute sealed : public Attribute
F#
[<SealedAttribute>]
[<ConditionalAttribute("CONTRACTS_FULL")>]
[<ConditionalAttribute("DEBUG")>]
[<AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface|AttributeTargets.Delegate, AllowMultiple = false, 
    Inherited = false)>]
type ContractClassAttribute =  
    class
        inherit Attribute
    end
Remarks

Types that are marked with this attribute have code contracts that are included in a separate type. The type that contains the contracts is specified in the constructor.

Examples

The following example shows how to use the ContractClassAttribute attribute to specify that the contracts for the IArray interface are contained in the IArrayContracts class.

Inheritance Hierarchy

System..::.Object
  System..::.Attribute
    System.Diagnostics.Contracts..::.ContractClassAttribute
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4
See Also

Reference

Page view tracker