BC36635:Lambda 表达式在“Select Case”语句的第一个表达式中无效

不能对 Select Case 语句中的测试表达式使用 Lambda 表达式。 Lambda 表达式返回函数委托,而 Select Case 语句的测试表达式必须是基本数据类型。

下面的代码会导致此错误:

' Select Case (Function(arg) arg Is Nothing)
    ' List of the cases.
' End Select

错误 ID:BC36635

更正此错误

  • 检查你的代码以确定是否可以使用其他条件构造,例如 If...Then...Else 语句。

  • 你可能打算调用该函数,如以下代码所示:

Dim num? As Integer
Select Case ((Function(arg? As Integer) arg Is Nothing)(num))
    ' List of the cases
End Select

请参阅