System.Linq.Expressions.Expression.Label C# (CSharp) Méthode

Label() public static méthode

Creates a LabelTarget representing a label with the given type.
public static Label ( Type type ) : LabelTarget
type Type The type of value that is passed when jumping to the label.
Résultat LabelTarget
        public static LabelTarget Label(Type type)
        {
            return Label(type, name: null);
        }

Same methods

Expression::Label ( LabelTarget target ) : LabelExpression
Expression::Label ( LabelTarget target, Expression defaultValue ) : LabelExpression
Expression::Label ( ) : LabelTarget
Expression::Label ( Type type, string name ) : LabelTarget
Expression::Label ( string name ) : LabelTarget

Usage Example

        protected override object VisitDoWhile(DoWhile W)
        {
            string name = target.LabelName();

            LinqExprs.LabelTarget begin = LinqExpr.Label("do_" + name + "_begin");
            LinqExprs.LabelTarget end   = LinqExpr.Label("do_" + name + "_end");
            loops.Push(new Loop(LinqExpr.Goto(end), LinqExpr.Goto(begin)));

            target.PushScope();

            // Check the condition, exit if necessary.
            target.Add(LinqExpr.Label(begin));

            // Generate the body target.
            Visit(W.Body);

            // Loop.
            target.Add(LinqExpr.IfThen(target.Compile(W.Condition), LinqExpr.Goto(begin)));

            // Exit label.
            target.Add(LinqExpr.Label(end));

            loops.Pop();
            target.PopScope();
            return(null);
        }
All Usage Examples Of System.Linq.Expressions.Expression::Label
Expression