How to evaluate column expressions without DataTables RRS feed

  • Question

  • Hi,

    I’m looking for a way to evaluate the column Expression available in ADO.NET … without using a DataTable instance.

    Say I have a column expression like iif(a > b, true, false)

    Is there a way to evaluate this expression by passing somehow values for a and b?

    I looked at the  Compute method on DataTable but it is not quite what I’m looking for:

    object result1 = new DataTable().Compute("20.0 / 2", null);

    object result3 = new DataTable().Compute("iif(10 > 5, true, false)", null);

    object result2 = new DataTable().Compute("iif(a > b, true, false)", null); -- how to evaluate this

    Idea behind this is to move away from DataTable to simple array structure for performance reason.

    Still I need to support a way to generate the legacy expression used.

    I would rather avoid building the expression string to generate this as it will be poor performance for large number of rows.

    Thanks in advance for your help


    Wednesday, October 17, 2018 10:57 AM

All replies