Say I have a list of column names that are populated in run-time. I mean average values for each column names How to use LINQ Expression to create, as if the query is grouped by:
var result = from the data in the view Group data by ANI number () {group = data.Field & lt; String & gt; ("Group_no")} new {group = grp.Key.Group in GRP, // add anonymous value for each column average}; As far as I can tell you that you can not tell within the anonymous scope?
Is there any way to do this?
Thank you. / P>
You can not
Instead, you can create a dictionary:
average = table. Columns Cast & lt; DataColumn & gt; (). ToDictionary (c = & gt; c.ColumnName, c => grp.Average (dr = & gt; Convert.ToDouble (dr [c]])) Convert. Coded is required because I do not know what Kalman is, and the average needs a specific numerical type.
If all the columns are the same numerical type, then you can change it with an artist.
Comments
Post a Comment