Beispiel #1
0
        /// <summary>
        /// Creates an If block that will be executed if the condition evaluates to true.
        /// </summary>
        public FluentIfBuilder <TThis> If(FluentExpression conditionExpression)
        {
            if (conditionExpression == null)
            {
                throw new ArgumentNullException("conditionExpression");
            }

            _CheckModifiable();
            var result = new FluentIfBuilder <TThis>(_this, _method, conditionExpression.Expression);

            _statements.Add(result);
            return(result);
        }
Beispiel #2
0
        public void StandardProperties()
        {
            // TODO: remove those CompilerGenerated attributes
            var type = TypeSignature.Class("MyType", ns, Accessibility.APublic);
            var prop = PropertySignature.Create("A", type, TypeSignature.String, Accessibility.APublic, Accessibility.AProtected);
            var td   = TypeDef.Empty(type).AddMember(
                new PropertyDef(prop,
                                getter: MethodDef.Create(prop.Getter, thisP => Expression.Constant("abcd")),
                                setter: MethodDef.Create(prop.Setter, (thisP, xP) =>
                                                         Expression.While(FluentExpression.Box(thisP).CallMethod(MethodSignature.Object_Equals, Expression.Default(TypeSignature.Object)), Expression.Nop))
                                )
                );

            cx.AddType(td);
            check.CheckOutput(cx);
        }
Beispiel #3
0
 /// <summary>
 /// Starts a For loop.
 /// </summary>
 public FluentForBuilder <TThis> For <T>(FluentExpression initialization, Expression <Func <bool> > condition, FluentExpression increment)
 {
     return(_For(initialization, condition.Body, increment));
 }
Beispiel #4
0
 /// <summary>
 /// Starts a For loop.
 /// </summary>
 public FluentForBuilder <TThis> For <T>(FluentExpression initialization, FluentExpression condition, FluentExpression increment)
 {
     return(_For(initialization, condition, increment));
 }
Beispiel #5
0
 /// <summary>
 /// Starts a For loop.
 /// </summary>
 public FluentForBuilder <TThis> For <T>(Expression <Func <T> > initialization, FluentExpression condition, Expression <Func <T> > increment)
 {
     return(_For(initialization.Body, condition, increment.Body));
 }