c# - Cast from generic class property -


i want cast generic class of propertytype , dont know how it.

i want this:

var key = expression.property(generictype, rule.comparisonpredicate); type propertytype = typeof(t).getproperty(rule.comparisonpredicate).propertytype;                                               var converter = typedescriptor.getconverter(propertytype); var value = expression.constant((propertytype)converter.convertfromstring(rule.comparisonvalue) ); 

but in line var value got error :

'propertytype' variable used type

you cannot cast variable, should specify real type

var value = expression.constant((propertytype)converter.convertfromstring(rule.comparisonvalue) );


Comments