Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FacilityID: 23
- FacilityName: ACME Medical Center
- Facility Location:
- RecordID: 1661
- Patient: Kistra Halos
- Gender: Female
- DOB: 7/20/1955
- ========================
- FacilityID: 24
- FacilityName: Medical Center
- Facility Location:
- RecordID: 166117
- Patient: Halos
- Gender: Male
- DOB: 9/20/1957
- static void Main(string[] args)
- {
- var PatientList = new List<Patient>();
- 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
- PatientList.Add(new Patient() { FacilityID = 24, FacilityName = "Schedule24", FacilityLocation = "M24", RecordID = 22, PatientName = "P24", Gender = "F", DOB = "01-05-1986" });
- PatientList.Add(new Patient() { FacilityID = 25, FacilityName = "Schedule25", FacilityLocation = "M25", RecordID = 33, PatientName = "P25", Gender = "M", DOB = "01-02-1989" });
- PatientList.Add(new Patient() { FacilityID = 26, FacilityName = "Schedule26", FacilityLocation = "M26", RecordID = 44, PatientName = "P26", Gender = "F", DOB = "01-02-1977" });
- PatientList.Add(new Patient() { FacilityID = 27, FacilityName = "Schedule27", FacilityLocation = "M27", RecordID = 55, PatientName = "P27", Gender = "M", DOB = "01-01-1927" });
- PatientList.Add(new Patient() { FacilityID = 28, FacilityName = "Schedule28", FacilityLocation = "M28", RecordID = 66, PatientName = "P28", Gender = "F", DOB = "01-05-1975" });
- Console.WriteLine("List Filter LINQ Way:");
- foreach (var v in from p in PatientList
- where p.PatientName == "P25" && p.FacilityName == "Schedule25"
- select new { p.PatientName, p.FacilityName })
- Console.WriteLine(v.PatientName + " is " + v.FacilityName);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement