Recently I was working on an EventHandler, Where I have to compare the User value in the Assigned To Field of the List with the other User value. Went down to Google and couldn’t find exact code I am looking for, here is the exact code that will do this.
SPUser spUser = GetSPUserOne();
SPUser spPrevUser = GetSPUserTwo();
For Windows Authentication This will do
For FBA you have to follow this
Hope this helps someone like me