Expression.Switch Method (Expression, Expression, MethodInfo, IEnumerable<SwitchCase>)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Creates a SwitchExpression that represents a switch statement that has a default case.

Namespace:  System.Linq.Expressions
Assembly:  System.Core (in System.Core.dll)

Syntax

'Declaration
Public Shared Function Switch ( _
    switchValue As Expression, _
    defaultBody As Expression, _
    comparison As MethodInfo, _
    cases As IEnumerable(Of SwitchCase) _
) As SwitchExpression
public static SwitchExpression Switch(
    Expression switchValue,
    Expression defaultBody,
    MethodInfo comparison,
    IEnumerable<SwitchCase> cases
)

Parameters

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.