Is there a difference when you generate a GUID using NewGuid();
vs System.Guid.NewGuid().ToString(\"D\");
or they are the same thing?
The generation algorithm has to be the same for both, because System.Guid.NewGuid().ToString("D")
is calling System.Guid.NewGuid()
, and then calling ToString
on the result, i.e., both of your examples are calling the same method to generate the guid. As to comparing the "format" - this does not make sense because System.Guid.NewGuid()
does not have a "format" in the same way as System.Guid.NewGuid().ToString("D")
- it is only by calling the ToString
method that you give the internal representation of the guid an external, string format. The format the string takes will depend on the argument you pass to the string method.