Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. FacilityID: 23
  2. FacilityName: ACME Medical Center
  3. Facility Location:
  4. RecordID: 1661
  5. Patient: Kistra Halos
  6. Gender: Female
  7. DOB: 7/20/1955
  8. ========================
  9. FacilityID: 24
  10. FacilityName: Medical Center
  11. Facility Location:
  12. RecordID: 166117
  13. Patient: Halos
  14. Gender: Male
  15. DOB: 9/20/1957
  16.  
  17. static void Main(string[] args)
  18. {
  19.  
  20. var PatientList = new List<Patient>();
  21.  
  22. PatientList.Add(new Patient() { FacilityID = 23, FacilityName = "Schedule23", FacilityLocation = "M23", RecordID = 11, PatientName = "P23", Gender = "F", DOB = "01-07-1987" }); //Non-Constructor Object Property Initialization
  23. PatientList.Add(new Patient() { FacilityID = 24, FacilityName = "Schedule24", FacilityLocation = "M24", RecordID = 22, PatientName = "P24", Gender = "F", DOB = "01-05-1986" });
  24. PatientList.Add(new Patient() { FacilityID = 25, FacilityName = "Schedule25", FacilityLocation = "M25", RecordID = 33, PatientName = "P25", Gender = "M", DOB = "01-02-1989" });
  25. PatientList.Add(new Patient() { FacilityID = 26, FacilityName = "Schedule26", FacilityLocation = "M26", RecordID = 44, PatientName = "P26", Gender = "F", DOB = "01-02-1977" });
  26. PatientList.Add(new Patient() { FacilityID = 27, FacilityName = "Schedule27", FacilityLocation = "M27", RecordID = 55, PatientName = "P27", Gender = "M", DOB = "01-01-1927" });
  27. PatientList.Add(new Patient() { FacilityID = 28, FacilityName = "Schedule28", FacilityLocation = "M28", RecordID = 66, PatientName = "P28", Gender = "F", DOB = "01-05-1975" });
  28.  
  29.  
  30. Console.WriteLine("List Filter LINQ Way:");
  31. foreach (var v in from p in PatientList
  32. where p.PatientName == "P25" && p.FacilityName == "Schedule25"
  33. select new { p.PatientName, p.FacilityName })
  34. Console.WriteLine(v.PatientName + " is " + v.FacilityName);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement