Expression.Switch Method (Type, Expression, Expression, MethodInfo, array<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 ( _
    type As Type, _
    switchValue As Expression, _
    defaultBody As Expression, _
    comparison As MethodInfo, _
    ParamArray cases As SwitchCase() _
) As SwitchExpression
public static SwitchExpression Switch(
    Type type,
    Expression switchValue,
    Expression defaultBody,
    MethodInfo comparison,
    params SwitchCase[] cases
)

Parameters

  • type
    Type: System.Type
    The result type of the switch.

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.