Вопрос

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

Try this form instead:

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

Другие советы

This should also work:

var query = dbManager.Table.Select(x=>new { column = x.column, cnst = 1 });
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top