I always forget useful stuff about GUID.
1. How to create GUID from string?
Guid newGuid = new Guid(Guid_As_String);
2. How to compare to GUID values?
Guid a;
Guid b;
if (a == b)
{
// Do something
}
You can compare them with == operator because it is overloaded for Guid type (see here).
3. How to get new Guid?
Guid a = Guid.NewGuid();
No comments:
Post a Comment