-10

I have such error:

Error 1 'System.Linq.Expressions.Expression' does not contain a definition for 'IfThenElse'

How to ommit it?

Here's code (The AluminiumLua library for C#):

public virtual void IfThenElse()
    {
        var Else = Expression.Call(stack.Pop(), LuaObject_AsFunction);
        var Then = Expression.Call(stack.Pop(), LuaObject_AsFunction);
        var Cond = Expression.Call(stack.Pop(), LuaObject_AsBool);
        stack.Push(Expression.IfThenElse(
            Cond,
            Expression.Call(Then, LuaFunction_Invoke, Expression.NewArrayInit(typeof(LuaObject), new Expression[] { })),
            Expression.Call(Else, LuaFunction_Invoke, Expression.NewArrayInit(typeof(LuaObject), new Expression[] { }))
        ));
    }
jrummell
  • 42,637
  • 17
  • 112
  • 171

2 Answers2

0

Expression.IfThenElse was introduced in .NET Framework 4, later than the Expression library (which was 3.5). So if you're working with some Expression code that requires 4.0, and you're using 3.5, it's possible that most of it will compile, but not IfThenElse.

I note that the most recent commit to AluminiumLua has as its commment

Now we require .NET 4.0

so if you are using the latest code you will need to follow this instruction.

I'm afraid I'm not really up to speed on what framework pieces are or aren't available in WP8 and/or XNA, but hopefully this will provide some useful clues.

AakashM
  • 62,551
  • 17
  • 151
  • 186
-1

I think you made a mistake. I think it is IfElse

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 13 '21 at 00:06
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30570924) – Erik McKelvey Dec 14 '21 at 01:47