c# - Is it possible to convert a string to its ExpressionType counterpart? -
i have string variable set add or subtract , wondering if possible convert system.linq.expressions.expressiontype of add or subtract can use in expression.makebinary().
right have looks similar this:
var operands = "subtract" expression.makebinary(operands, system.linq.expressions.expression.constant(50),system.linq.expressions.expression.constant(20)); i realize may not best code, trying limit room error right , see if possible convert string it's expressiontype.
note: has crossed mind possible switch, end result try , make calculations dynamic possible.
yes, expressiontype enum. here how can parse string expressiontype:
expressiontype t = (expressiontype)enum.parse(typeof(expressiontype), "subtract");
Comments
Post a Comment