You just have to rely on the fact that these are 32 hexadecimal characters, there can be many ways to represent it. See the Wikipedia article for details, including a description of how they are usually written.
For your conversion, you must really rely on the static methods of Guid.Parse () . Using a combination of your example and the ones listed in icktoofay answer , this works great:
var z = Guid.Parse("aaaef973-d8ce-4c92-95b4-3635bb2d42d5"); z = Guid.Parse("{aaaef973-d8ce-4c92-95b4-3635bb2d42d5}"); z = Guid.Parse("{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}");
then you can use the Guid.ToString () method with one of the installed format codes to display them with hyphens or without them.
slugster
source share