System.Reflection.Emit.ILGenerator.DefineLabel C# (CSharp) Method

DefineLabel() public method

public DefineLabel ( ) : System.Reflection.Emit.Label
return System.Reflection.Emit.Label
        public virtual System.Reflection.Emit.Label DefineLabel() { throw null; }
        public virtual void Emit(System.Reflection.Emit.OpCode opcode) { }

Usage Example

示例#1
6
        public override void Emit(ILGenerator gen, bool labelSetAlready)
        {
            if (!labelSetAlready) MarkLabel(gen);

            Label condition = gen.DefineLabel();
            Label start = gen.DefineLabel();

            // Initialize
            init.Emit(gen, true);

            // Branch to condition label
            gen.Emit(OpCodes.Br, condition);

            // Mark start of loop
            gen.MarkLabel(start);

            // Execute loop
            stmt.Emit(gen);

            // Update counter
            update.Emit(gen);

            gen.MarkLabel(condition);
            comparison.Emit(gen);
            gen.Emit(OpCodes.Brtrue, start);
        }
All Usage Examples Of System.Reflection.Emit.ILGenerator::DefineLabel