I'm generating a c# Linq expression dynamically as below, which will (in the example below) run string.Contains against the collection values.
var dynamicMethod = "Contains";
var parameter = Expression.Parameter(typeof (MyClass), "type");
var property = Expression.Property(parameter, "MyProperty");
var constantValue = Expression.Constant("PropertyValue", property.Type);
var method = property.Type.GetMethod(dynamicMethod, new[] {property.Type});
var expression = Expression.Call(property, method, constantValue);
For the above code, I'd want something equivalent to !Contains.
Any suggestions?
Thanks.