共用方式為


DbExpressionBuilder.Case 方法

定義

建立新的 DbCaseExpression

public:
 static System::Data::Common::CommandTrees::DbCaseExpression ^ Case(System::Collections::Generic::IEnumerable<System::Data::Common::CommandTrees::DbExpression ^> ^ whenExpressions, System::Collections::Generic::IEnumerable<System::Data::Common::CommandTrees::DbExpression ^> ^ thenExpressions, System::Data::Common::CommandTrees::DbExpression ^ elseExpression);
public static System.Data.Common.CommandTrees.DbCaseExpression Case (System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> whenExpressions, System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> thenExpressions, System.Data.Common.CommandTrees.DbExpression elseExpression);
static member Case : seq<System.Data.Common.CommandTrees.DbExpression> * seq<System.Data.Common.CommandTrees.DbExpression> * System.Data.Common.CommandTrees.DbExpression -> System.Data.Common.CommandTrees.DbCaseExpression
Public Function Case (whenExpressions As IEnumerable(Of DbExpression), thenExpressions As IEnumerable(Of DbExpression), elseExpression As DbExpression) As DbCaseExpression

參數

whenExpressions
IEnumerable<DbExpression>

運算式清單,提供各種案例的條件。

thenExpressions
IEnumerable<DbExpression>

運算式清單,提供各種案例的結果。

elseExpression
DbExpression

運算式,定義在沒有符合任何案例時的結果。

傳回

具有指定之大小寫及預設結果的新 DbCaseExpression。

例外狀況

whenExpressionsthenExpressions 為 null 或包含 null,或是 elseExpression 為 null。

whenExpressionsthenExpressions 是空的,或者 whenExpressions 內含的運算式不是布林結果型別,或沒有通用的結果型別存在於 thenExpressionselseExpression 中的所有運算式。

適用於