Hi there:
So the problem is I have the following line wehre value is a string
var filterValue = Expression.Constant(value, property.Type);
if property.Type is a string everything is fine however the type really could be anything, like a decimal?
I dont know how to make this work for all different types I have this function
private static T Parse (string value) { return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(value); }
using that I can do this:
var newValue = Parse(value); var filterValue = Expression.Constant(newValue, property.Type);
however I would have to know in advance the type , I tried
var newValue = Parse(value);
but that doesnt work
Any ideas?