Click or drag to resize
VariableSwitch Method
Microsoft Research
Opens a stochastic switch statement using the specified condition variable. This is equivalent to creating a set of identical Variable.Case() statements for each value of i. Within a switch block, you can use the variable i as an array index.

Namespace: MicrosoftResearch.Infer.Models
Assembly: Infer.Compiler (in Infer.Compiler.dll) Version: 2.6.41128.1 (2.6.41128.1)
Syntax
public static SwitchBlock Switch(
	Variable<int> i
)

Parameters

i
Type: MicrosoftResearch.Infer.ModelsVariableInt32
The condition of the switch block

Return Value

Type: SwitchBlock
A SwitchBlock object which must be closed before inference is performed.
Remarks
This method should be used as the argument to a using() statement, so that the if statement is automatically closed. If this is not possible, the returned SwitchBlock must be closed manually by calling CloseBlock().
See Also