PostSharp4.3//API Reference/Post­Sharp.​Reflection.​Syntax Namespace/ISwitch­Expression Interface
ISwitchExpression Interface
Expression that represent a switch (conditional statement with multiple branches).

Namespace: PostSharp.Reflection.Syntax
Assembly: PostSharp (in PostSharp.dll) Version: (
public interface ISwitchExpression : IExpression, 

The ISwitchExpression type exposes the following members.

Public propertyCondition
Gets the condition expression.
Public propertyParentElement
Gets the parent element in the tree.
(Inherited from ISyntaxElement.)
Public propertyParentMethodBody
Gets the parent method body.
(Inherited from ISyntaxElement.)
Public propertyReturnType
Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction).
(Inherited from IExpression.)
Public propertySyntaxElementKind
Gets the kind of syntax element.
(Inherited from ISyntaxElement.)
Public propertyTargets
Gets the list of target blocks.

This interface represents the MSIL switch statement, not the C# statement. The main difference is that switch cases have no value: the value of a switch case is equal to its position in the list of Targets.

See Also