Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

How to evaluate column expressions without DataTables

$
0
0

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

Nick



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>