How to add a constant into LINQ query in BLtoolkit

300 Views Asked by At

Im trying to add a constant to a LINQ query in BLtoolkit.

var query = dbManager.Table.Select(x=>new { x.column, cnst = 1 });

but in the result there is only 'column' column, but no 'cnst' column.

2

There are 2 best solutions below

5
Robert Harvey On BEST ANSWER

Try this form instead:

var query = from x in dbManager.Table
        select new
        {
            x.column,
            cnst = 1
        };
0
Hogan On

This should also work:

var query = dbManager.Table.Select(x=>new { column = x.column, cnst = 1 });