I had to check "equality" between two different values stored in generic column in generic lists.
Suppose I have two SharePoint installation and a WebPart. The webpart had to check differences between list items of the two list of givens fields.
Suppose I had:
As is, I select from my webpart the two lists the key value and the "column to compare".
Suppose I select ColA as Key and ColC as "column to compare".
My code uses Client Object Model to access to the remote list and the normal API for the current context list.
Now I'm facing a comparison problem:
in my code I have:
if (item[field] == remoteField[field]) --> do some code else --> other
As you can imagine this always returns "false". How can I compare the two object without reflection to face the fact that if they are Text uses the right comparer, if they are numeric another and so on?
I also tried this way, but I imagine is not the correct one:
if (item[field] != null && remoteItem[field] != null && remoteItem[field].ToString().Equals(item[field].ToString()))
Thank you very much!