by Bjørn Storkholm
2. July 2009 13:22
I started writing a small application, which can handle objects in Pocket Outlook Object Model (POOM) items, aka Appointments, Contacts etc.
Writing a simple LinQ query to select my appointments, with a specific subject:
IEnumerable<Appointment> filteredAppointments = from appointment in appointments
where appointment.Subject == "Cornelius 2001"
select appointment;
I was astonished to find, that this gives a compilation error, with a description saying “Could not find an implementation of the query pattern for source type”. Since I previously did a lot of work with POOM, I’m not that surprised with the fact, that there are always surprises.
Search Google for 5 minutes gave the solution. Explicitly specify the type of the object you want to select:
IEnumerable<Appointment> filteredAppointments = from Appointment appointment in appointments
where appointment.Subject == "Cornelius 2001"
select appointment;