check Invariant
Execute block and validate the invariant condition before and after execution.
If invariant checks are disabled, this function executes block without validation.
Return
The result of executing block.
Parameters
The detail message for the exception if an invariant check fails.
The operation to execute on this object.
Type Parameters
The type that implements HasInvariant.
The return type of block.
Throws
If the invariant is false before or after block runs.
Validate the invariant condition immediately if invariant checks are enabled.
Return
This object instance.
Parameters
The detail message for the exception if the invariant check fails.
Type Parameters
The type that implements HasInvariant.
Throws
If invariant checks are enabled and HasInvariant.invariant returns false.
Validate the invariant condition immediately if invariant checks are enabled.
Return
This object instance.
Parameters
A function that returns the message for the exception if the invariant check fails.
Type Parameters
The type that implements HasInvariant.
Throws
If invariant checks are enabled and HasInvariant.invariant returns false.