Redigera

Dela via


InstructionEncoder.Switch(Int32) Method

Definition

Starts encoding a switch instruction.

public:
 System::Reflection::Metadata::Ecma335::SwitchInstructionEncoder Switch(int branchCount);
public System.Reflection.Metadata.Ecma335.SwitchInstructionEncoder Switch (int branchCount);
member this.Switch : int -> System.Reflection.Metadata.Ecma335.SwitchInstructionEncoder
Public Function Switch (branchCount As Integer) As SwitchInstructionEncoder

Parameters

branchCount
Int32

The number of branches the instruction will have.

Returns

A SwitchInstructionEncoder that will be used to emit the labels for the branches.

Exceptions

branchCount is less than or equal to zero.

Branch(LabelHandle) was not called on the returned value exactly branchCount times.

Remarks

Before using this InstructionEncoder in any other way, the method Branch(LabelHandle) must be called on the returned value exactly branchCount times. Failure to do so will throw InvalidOperationException.

Applies to