System.Linq.Expressions.Expression.Throw C# (CSharp) Method

Throw() public static method

Creates a UnaryExpression that represents a throwing of an exception.
public static Throw ( Expression value ) : UnaryExpression
value Expression An .
return UnaryExpression
        public static UnaryExpression Throw(Expression value)
        {
            return Throw(value, typeof(void));
        }

Same methods

Expression::Throw ( Expression value, Type type ) : UnaryExpression

Usage Example

Ejemplo n.º 1
0
        internal MetaObject /*!*/ CreateMetaObject(MetaObjectBinder /*!*/ action, MetaObject /*!*/[] /*!*/ siteArgs)
        {
            var expr = _error ? Ast.Throw(_result) : _result;

            Restrictions restrictions;

            if (_condition != null)
            {
                var deferral = action.Defer(siteArgs);
                expr         = Ast.Condition(_condition, AstUtils.Convert(expr, typeof(object)), deferral.Expression);
                restrictions = deferral.Restrictions;
            }
            else
            {
                restrictions = Restrictions.Empty;
            }

            if (_temps != null)
            {
                expr = Ast.Block(_temps, expr);
            }

            if (_restriction != null)
            {
                restrictions = restrictions.Merge(Restrictions.GetExpressionRestriction(_restriction));
            }

            return(new MetaObject(expr, restrictions));
        }
All Usage Examples Of System.Linq.Expressions.Expression::Throw
Expression