I change this now it working as expected
for string i want like
other than string i want equal
static Expression<Func<T, bool>> GetExpression<T>(string propertyName, string propertyValue)
{
var parameterExp = Expression.Parameter(typeof(T), "type");
var propertyExp = Expression.Property(parameterExp, propertyName);
if (propertyExp.Type == typeof(string))
{
MethodInfo method = typeof(string).GetMethod("Contains", new[] { typeof(string) });
var someValue = Expression.Constant(propertyValue, typeof(string));
var containsMethodExp = Expression.Call(propertyExp, method, someValue);
return Expression.Lambda<Func<T, bool>>(containsMethodExp, parameterExp);
}
else
{
var converter = TypeDescriptor.GetConverter(propertyExp.Type);
var result = converter.ConvertFrom(propertyValue);
var someValue = Expression.Constant(result);
var containsMethodExp = Expression.Equal(propertyExp, someValue);
return Expression.Lambda<Func<T, bool>>(containsMethodExp, parameterExp);
}
}