Friday, April 3, 2020

Cast a Guid to a string in C# while handing in a conditional magic argument.

Guid guid = Guid.NewGuid();
string go = guid.ToString();
string d = guid.ToString("D");
string n = guid.ToString("N");
string b = guid.ToString("B");
string p = guid.ToString("P");
string x = guid.ToString("X");

 
 

146aa746-e433-4540-b2cb-9dac7e4a34e4 is the assignment for lines two and three. Then 146aa746e4334540b2cb9dac7e4a34e4 and then {146aa746-e433-4540-b2cb-9dac7e4a34e4} followed by (146aa746-e433-4540-b2cb-9dac7e4a34e4) and finally {0x146aa746,0xe433,0x4540,{0xb2,0xcb,0x9d,0xac,0x7e,0x4a,0x34,0xe4}} is last. The second to last chapter of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis had this nuget of wisdom.

No comments:

Post a Comment