Given:
string metadata.XAxisColumn -- contains a column name (e.g., "Date")
string metadata.YAxisColumn -- contains another columnname (e.g., "Close")
When I know the names of the columns up front, of course I can do:
var query = from record in myView
where record.Date >= startDate && record.Date <= endDate
select record.Close
However, the column names are not known until runtime. They're in metadata.XAxisColumn
and metadata.YAxisColumn
.
What is the correct way to construct a query that works like this:
var query = from record in myView
where record.[metadata.XAxisColumn] >= startDate && record.[metadata.XAxisColumn] <= endDate
select record.[metadata.YAxisColumn]