[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)
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
Dim instance As ContractClassAttribute
[ConditionalAttribute("CONTRACTS_FULL")]
[ConditionalAttribute("DEBUG")]
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface|AttributeTargets.Delegate, AllowMultiple = false,
Inherited = false)]
public sealed class ContractClassAttribute : Attribute
[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
[<SealedAttribute>]
[<ConditionalAttribute("CONTRACTS_FULL")>]
[<ConditionalAttribute("DEBUG")>]
[<AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface|AttributeTargets.Delegate, AllowMultiple = false,
Inherited = false)>]
type ContractClassAttribute =
class
inherit Attribute
end
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.
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.
System..::.Object
System..::.Attribute
System.Diagnostics.Contracts..::.ContractClassAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
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.
.NET Framework
Supported in: 4
.NET Framework Client Profile
Supported in: 4
Reference