Statement that works in .NET 3.5 throws "error CS0117: 'System.Linq.Dynamic.DynamicExpression' does not contain a definition for 'ParseLamba'" in 4.5

StackOverflow https://stackoverflow.com/questions/20789491

Question

How can the statement below be converted to .NET 4.5? I was using sampler project code which is version 3.5.

LambdaExpression lambdaExpression =
 System.Linq.Dynamic.DynamicExpression.ParseLambda(objectType, typeof(bool), expression);

I tried to System.Linq.Expressions.DynamicExpression but it doesn't have ParseLambda method.

In a project targeting .NET 4.5.1 (or 4.5, it makes no difference), after installing the System.Linq.Dynamic nuget package, version 1.0.0, the compiler gives this error:

error CS0117: 'System.Linq.Dynamic.DynamicExpression' does not contain a definition for 'ParseLamba'.

It can clearly find the class. It just can't find the method. Inspecting the System.Linq.Dynamic assembly in Object Browser shows that the method is public and static. So why the compiler error?

Was it helpful?

Solution

You need to install the NuGet System.Linq.Dynamic package, which works for any .net 4.0+ code.

https://github.com/kahanu/System.Linq.Dynamic

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top