TriAxis.RunSharp.CodeGen.Local C# (CSharp) Method

Local() public method

public Local ( ) : ContextualOperand
return ContextualOperand
	    public ContextualOperand Local()
		{
			return new ContextualOperand(new _Local(this), TypeMapper);
		}

Same methods

CodeGen::Local ( Operand init ) : ContextualOperand
CodeGen::Local ( System type ) : ContextualOperand
CodeGen::Local ( System type, Operand init ) : ContextualOperand
CodeGen::Local ( Type type ) : ContextualOperand
CodeGen::Local ( Type type, Operand init ) : ContextualOperand

Usage Example

Example #1
0
        static void DynamicMethodExamples()
        {
            DynamicMethodGen dmg = DynamicMethodGen.Static(typeof(Program)).Method(typeof(void)).Parameter(typeof(string), "name");
            CodeGen          g   = dmg.GetCode();

            g.Try();
            {
                Operand name = g.Local(typeof(string), g.Arg("name"));
                g.WriteLine("Hello {0}!", name);
            }
            g.CatchAll();
            {
                g.WriteLine("Error");
            }
            g.End();

            DynamicMethod dm = dmg.GetCompletedDynamicMethod(true);

            // reflection-style invocation
            dm.Invoke(null, new object[] { "Dynamic Method" });

            // delegate invocation
            Action <string> hello = (Action <string>)dm.CreateDelegate(typeof(Action <string>));

            hello("Delegate");
        }
All Usage Examples Of TriAxis.RunSharp.CodeGen::Local