The Guid itself is actually a 128-bit integer value and the string is a hexadecimal representation of the same value and hexadecimal is not case sensitive.
Guid.Parse("429637FA-C124-4a37-8DBD-09F103419313") and Guid.Parse("429637fa-c124-4a37-8dbd-09f103419313") will be equal:
Guid a = Guid.Parse("429637fa-c124-4a37-8dbd-09f103419313");
Guid b = Guid.Parse("429637FA-C124-4a37-8DBD-09F103419313");
bool equal = a.Equals(b); //true
If you want to compare the string representation of a GUID with a System.String, you can use the ToLower() or ToUpper() method:
if(guid.ToString().ToLower().Equals(s.ToLower()))
...
No comments:
Post a Comment