In the code below, I want to compare two GUIDs. The problem is I don\'t get any tasks returned because the GUIDS are different case (uppercase vs. lowercase). I need to perf
The == is overloaded on Guid so you don't need to compare the string representations.
See http://msdn.microsoft.com/en-us/library/system.guid.op_equality(v=VS.90).aspx
An easy way to ignore case when doing a string comparison is just convert everything to lower (or upper) case before you compare it. So:
var userTasks = dc.tasks.Where(t => t.user_id.ToString().ToLower() == userId.ToString().ToLower()).ToList();
That being said, I agree with the other commenters that you should be using a native GUID comparison, not a string comparison.
Not sure why you're comparing them as text, but instead of t.user_id == userId
use t.userId.Equals(userId, StringComparison.OrdinalIgnoreCase)
I always had a dillema of using == for guid/uniqueidentifier columns comparison in linq statements (especially in where clause) so I took a rather safe route of using - (entityGuidColumn.CompareTo(guidParameter)==0) . This worked for me. Give it a shot.