Exemplo n.º 1
0
        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));
        }
Exemplo n.º 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()));
        }