Conditional operator in expression trees RRS feed

  • Question

  • Are there plans to support the conditional operator (the "?" operator) in expression trees at some point? Right now I have to wrap each conditional sub-expression in a method call to get it to "fit", otherwise the compiler complains that "The expression contains operations that cannot be translated to a System.Expressions.Expression type".

    Perusing the Expression class shows that there's a subclass called TernaryExpression, presumably for just such a use. But the absence of Conditional() factory in the Expression class leads me to think that it was never actually implemented.

    I fully understand that it's not really needed for the current use of expression trees, but I have the feeling that expression trees will be one of the "sleeper" features of LINQ, and I've got my fingers crossed for a full, rich eventual implementation.

    Saturday, March 4, 2006 8:24 AM


  • Conditional operators will be supported in the next preview of LINQ.
    Tuesday, April 11, 2006 8:33 PM