public Tracker(Patient patient, string type) { this.Type = type; this.Patient = patient; this.Observations = patient.GetAllObservationsByCodeText(type); Observations.Sort((x, y) => { if (x.Issued == null || y.Issued == null) { return(1); } return(((DateTime)x.Issued).CompareTo((DateTime)y.Issued)); }); this.GraphData = new List <decimal>(); foreach (Observation observation in Observations) { GraphData.Add((decimal)observation.MeasurementResult.Value); } }