c# - Linq average in Dictionary -
I have a dictionary and want to get the average of attendance from a particular time frame. So far, I have this work which gives me the number of attendance:
var vCounts = (from pil.in.List to pil.Value in where (s.CheckInActualUtc.TimeOfDay & Gt; = TStart & amp;; & amp; Amp; s.CheckInActualUtc.TimeOfDay & lt; = TEND). s.CheckInActualUtc has more than one date.
How to get the avarage of attendance? I have tried this, but do not go one: var vAverage = plan in pil in INInList pil.Value where (s.CheckInActualUtc.TimeOfDay> = TStart & amp; amp; s.CheckInActualUtc.TimeOfDay & lt; = TEND) Select s.CheckInActualUtc.DayOfYear by Group S new {av = g.Average ()}; If you mean, then you want the average of the number of people present per day :
var vAverage = (in pilInInfoList pil.Value of pil where (s.CheckInActualUtc.TimeOfDay & gt; = TStart & amp; amp; s.CheckInActualUtc.TimeOfDay & lt; = TEND ) Select Group S. S.CheckInActualUtc.DayOfYear in g.Count ()). Average ();
Comments
Post a Comment