public override ValueExpression Evaluate(ITemplateContext context) { ClassName className = _typeExpression.Evaluate(context).Value as ClassName; if (className == null) { throw new ArgumentException("Type cast requires a type name"); } return(Expression.Value(Convert.ChangeType(_targetExpression.Evaluate(context).Value, className.Type), className.Type)); }
public override ValueExpression Evaluate(ITemplateContext context) { ClassName className = _className.Evaluate(context).Value as ClassName; if (className == null) { throw new TypeInitializationException(_className.Variable, null); } return(Expression.Value(className.Type.GetConstructors())); }
private static Type GetTypeOfClassName(ClassName className) { return(className.Type); }