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

Break() public static method

Creates a GotoExpression representing a break statement. The value passed to the label upon jumping can be specified.
public static Break ( LabelTarget target, Expression value ) : GotoExpression
target LabelTarget The that the will jump to.
value Expression The value that will be passed to the associated label upon jumping.
return GotoExpression
        public static GotoExpression Break(LabelTarget target, Expression value)
        {
            return MakeGoto(GotoExpressionKind.Break, target, value, typeof(void));
        }

Same methods

Expression::Break ( LabelTarget target ) : GotoExpression
Expression::Break ( LabelTarget target, Expression value, Type type ) : GotoExpression
Expression::Break ( LabelTarget target, Type type ) : GotoExpression

Usage Example

Exemplo n.º 1
0
        private GotoExpression GotoExpression(
            ExpressionType nodeType, System.Type type, JObject obj)
        {
            var value      = this.Expression(this.Prop(obj, "value"));
            var kind       = this.Enum <GotoExpressionKind>(this.Prop(obj, "kind"));
            var targetType = this.Type(this.Prop(obj, "targetType"));
            var targetName = this.Prop(obj, "targetName").Value <string>();

            switch (kind)
            {
            case GotoExpressionKind.Break:
                return(Expr.Break(CreateLabelTarget(targetName, targetType), value));

            case GotoExpressionKind.Continue:
                return(Expr.Continue(CreateLabelTarget(targetName, targetType)));

            case GotoExpressionKind.Goto:
                return(Expr.Goto(CreateLabelTarget(targetName, targetType), value));

            case GotoExpressionKind.Return:
                return(Expr.Return(CreateLabelTarget(targetName, targetType), value));

            default:
                throw new NotImplementedException();
            }
        }
All Usage Examples Of System.Linq.Expressions.Expression::Break
Expression