Apparently C# (or Visual Studio) generates a GUID for each class. I can get the GUID using the following code:
Type myType = typeof(myObject);
Guid myGuid = (Guid)myType.GUID.
My question is when does this GUID change. Is it generated based on a code change or is it based on class creation? I'd appreciate a point towards some relevant documentation.
Thanks
I don't think there is documentation on how C#/.Net "automatically" generates the GUID for type.
If you need the Guid to stay persistent (or control it in some other way) you should use GuidAttribute instead of letting system to create one for you:
[System.Runtime.InteropServices.GuidAttribute("00000000-0000-0000-feed-000000000000")]
class Test1{};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With