System.Diagnostics.Contracts.ContractInvariantMethodAttribute Class

Marks a method as being the invariant method for a class.

See Also: ContractInvariantMethodAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
[System.Diagnostics.Conditional("CONTRACTS_FULL")]
public sealed class ContractInvariantMethodAttribute : Attribute

Remarks

The invariant method can have any name, but it must return void and take no parameters. A suggested name for the method is ObjectInvariant. The body of the invariant method must consist solely of one or more calls to the Contract.Invariant(bool) method. A type can have more than one contract invariant method, which can be public or private.

Requirements

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