Exemplo n.º 1
0
 public static Maybe <object> SimpleEval(Expression lambdaContainer)
 {
     return(MaybeExtension.OrElse <object>(
                MaybeExtension.SelectMany(
                    MaybeExtension.SelectMany(
                        MaybeExtension.SelectMany(
                            MaybeExtension.MaybeAs <MethodCallExpression>((object)lambdaContainer, true), (Func <MethodCallExpression, Maybe <ConstantExpression> >)
                                (methodCallExpression => MaybeExtension.MaybeAs <ConstantExpression>((object)methodCallExpression.Object, false)),
                            (methodCallExpression, @object) =>
     {
         var local_0 = new
         {
             methodCallExpression = methodCallExpression,
             @object = @object
         };
         return local_0;
     }), param0 => Evaluator.GetParameters(param0.methodCallExpression),
                        (param0, parameters) =>
     {
         var local_0 = new
         {
             par = param0,
             parameters = parameters
         };
         return local_0;
     }), param0 => MaybeExtension.ToMaybe <object>(param0.par.methodCallExpression.Method.Invoke(param0.par.@object == null ? (object)null : [email protected], Enumerable.ToArray <object>(param0.parameters))), (param0, lambdaExpression) => lambdaExpression), (Func <Maybe <object> >)(() => Evaluator.Evaluate(lambdaContainer))));
 }
Exemplo n.º 2
0
 public Maybe <T> ToMaybe()
 {
     return(MaybeExtension.ToMaybe <T>(this._value));
 }