Edit

Share via


Multi-dimensional array cannot be converted to an expression tree

Most expressions can be converted to expression trees, but multi-dimensional arrays cannot be. For example, the following code causes this error:

Module Module1  
    Sub Main()  
        '' A multi-dimensional array cannot be converted.  
        'Dim expTree As Expressions.Expression(Of Func(Of Object)) = _  
        '    Function() New Integer(1, 1) {{1, 2}, {2, 3}}  
  
        ' A one-dimensional array can be converted.  
        Dim expTree2 As Expressions.Expression(Of Func(Of Object)) = _  
            Function() New Integer() {1, 2, 3}  
    End Sub  
End Module  

Error ID: BC36603

See also