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));
        }
Beispiel #2
0
        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()));
        }
Beispiel #3
0
 private static Type GetTypeOfClassName(ClassName className)
 {
     return(className.Type);
 }