Contract::Invariant Method (Boolean)
Specifies an invariant contract for the enclosing method or property.
Assembly: mscorlib (in mscorlib.dll)
This contract can be specified only in a dedicated invariant method that is declared on a class. If the method is not sealed, it should refer only to protected members, not private members, so that subclasses can be sure to maintain the invariants.
This contract is not exposed to clients; therefore, it may reference members that are less visible than the enclosing method.
You must use the binary rewriter for run-time enforcement of this invariant.
Invariants are conditionally defined based on the presence of the CONTRACTS FULL symbol. During run-time checking, invariants are checked at the end of each public method. If an invariant mentions a public method in the same class, the invariant check that would normally happen at the end of that public method is disabled and checked only at the end of the outermost method call to that class. This also happens if the class is re-entered because of a call to a method on another class.
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.