I can't reproduce the problem:
using System;
class Program
{
static void Main(string[] args)
{
Guid x = Guid.NewGuid();
Guid y = new Guid(x.ToString());
Console.WriteLine(x == y);
Console.WriteLine(x.Equals(y));
Console.WriteLine(x.ToString() == y.ToString());
}
}
Produces:
True
True
True
Please give a similar short but complete program which demonstrates the problem.
EDIT: I think I see the problem now, and it's in your code:
if (ultraCalendarInfo.Owners[i].Key.ToString().Equals(committeeId))
You've stated:
The .Key
below has a Guid and committeeId
is a Guid too.
You're calling ToString()
on the Guid but not on committeeId
, so that condition will never be true. If you called ToString()
on both or neither it should be fine.
I strongly suspect that this (or something very similar, if the above isn't your real code) is the problem. Calling ToString()
more than once (i.e. guid.ToString().ToString()
etc) will always return the same string, of course - so if you have an unbalanced number of ToString()
calls (0 on one side and 1 on the other) then adding an extra call to both sides would "fix" the problem... but removing one of the ToString()
calls is the real fix.