I am developing a program using Microsoft Azure Mobile Service.
On the client side I have queried two different MobileServiceCollection data, and I'm trying to compare them in the client application.
private MobileServiceCollection<StaffRecord, StaffRecord> unCheckinRecords
//local data
private MobileServiceCollection<StaffRecord, StaffRecord> pollUncheckinRecords;
//polled latest data
I would like to compare my polled data with the local data. First I tried to use the .Contains provide by MobileServiceCollection
foreach (StaffRecord record in unCheckinRecords)
{
if (pollUncheckinRecords.Contains(record)) //if the record is no more in uncheckin status
{
listRecordIDs.Add(record.ID);
}
}
These two list suppose to have only one different record only, however, when iterate through by the foreach loop, .Contains return false for every single record. It seems not comparing the objects in the list.
I tried another approach. I convert pollUncheckinRecords to List
foreach (StaffRecord record in unCheckinRecords)
{
listPollUncheckinRecords.Remove(record);
}
Yet it doesn't work with a list of StaffRecord as well. None of the records where removed.
Does anyone know what's wrong here? How to compare the object items in the MobileServiceCollection?