System.Diagnostics.Contracts.ContractInvariantMethodAttribute Class

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

See Also: ContractInvariantMethodAttribute Members


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


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.


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