public void If_Condition_And() { DynamicMethod method = new DynamicMethod("temp", typeof(int), Type.EmptyTypes); MethodGenerator g = new MethodGenerator(method); var a = g.Declare(5); g.If(() => {//a<10 && a>6 g.And(() => { g.Load(a); g.Load(10); return(LogicOperator.LessThan); }, () => { g.Load(a); g.Load(6); return(LogicOperator.GreaterThan); }); return(LogicOperator.IsTrue); }, () => { g.Increment(a); }); g.Load(a); g.Return(); int result = (int)method.Invoke(null, new object[] { }); Assert.AreEqual(5, result); }