private void btnShowTestResults_Click(object sender, EventArgs e) { // get test results for patient Bundle results = client.Search <DiagnosticReport>(new string[] { $"patient={patient.Id}" }); foreach (Bundle.EntryComponent entryComponent in results.Entry) { // add the DiagnosticReport to the list... DiagnosticReport report = entryComponent.Resource as DiagnosticReport; string testReportId = report.Id; string test = report.GetExtension("http://wales.nhs.uk/fhir/extensions/DiagnosticReport-WrrsReportTitle").Value.ToString(); string effectiveDate = ((FhirDateTime)report.Effective).ToDateTime().Value.ToString("dd-MMM-yyyy"); string organisation = ""; DiagnosticReport.PerformerComponent firstOrDefault = report.Performer.FirstOrDefault(); if (firstOrDefault != null) { organisation = firstOrDefault.Actor.Display; } var lvi = new ListViewItem(testReportId); lvi.SubItems.Add(test); lvi.SubItems.Add(effectiveDate); lvi.SubItems.Add(organisation); lstTestResults.Items.Add(lvi); } }