Click or drag to resize

ContractRequiresMessage Method (Boolean, FuncString, String, String, String)

[This is preliminary documentation and is subject to change.]

Specifies a precondition contract for the enclosing method or property, and displays a message if the condition for the contract fails.

Namespace:  Umbrace.Unity.Contracts
Assembly:  Umbrace.Unity.PurePool (in Umbrace.Unity.PurePool.dll) Version: 0.0.0.0 (1.0.0.0)
Syntax
C#
[ConditionalAttribute("CONTRACTS_REQUIRES")]
[ConditionalAttribute("CONTRACTS_FULL")]
public static void RequiresMessage(
	bool condition,
	Func<string, string> messageBuilder,
	string arg1,
	string memberName = null
)

Parameters

condition
Type: SystemBoolean
The conditional expression to test.
messageBuilder
Type: SystemFuncString, String
A function that returns the message to display if the condition is .
arg1
Type: SystemString
The first argument to be passed to messageBuilder.
memberName (Optional)
Type: SystemString
Remarks
This method allows string formatting and concatenation to be performed after it is known whether the message will be displayed. This avoids generating unnecessary allocations, and therefore also avoids the associated increase in garbage collector pressure.
See Also