Case Method

DbExpressionBuilder.Case Method (IEnumerable<DbExpression>, IEnumerable<DbExpression>, DbExpression)

.NET Framework (current version)
 

Creates a new DbCaseExpression.

Namespace:   System.Data.Common.CommandTrees.ExpressionBuilder
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static DbCaseExpression Case(
	IEnumerable<DbExpression> whenExpressions,
	IEnumerable<DbExpression> thenExpressions,
	DbExpression elseExpression
)

Parameters

whenExpressions
Type: System.Collections.Generic.IEnumerable<DbExpression>

A list of expressions that provide the conditional for of each case.

thenExpressions
Type: System.Collections.Generic.IEnumerable<DbExpression>

A list of expressions that provide the result of each case.

elseExpression
Type: System.Data.Common.CommandTrees.DbExpression

An expression that defines the result when no case is matched.

Return Value

Type: System.Data.Common.CommandTrees.DbCaseExpression

A new DbCaseExpression with the specified cases and default result.

Exception Condition
ArgumentNullException

whenExpressions or thenExpressions is null or contains null, or elseExpression is null.

ArgumentException

whenExpressions or thenExpressions is empty or whenExpressions contains an expression with a non-Boolean result type, or no common result type exists for all expressions in thenExpressions and elseExpression.

.NET Framework
Available since 4.5
Return to top
Show:
© 2016 Microsoft