How to create a Guid
that all of its elements are zero. i.e. {00000000-0000-0000-0000-000000000000}
. I could use:
Guid.Parse("{00000000-0000-0000-0000-000000000000}")
But is there any easier method for that ?
If you want to create an empty Guid, you can use Guid. Empty : it will return a Guid composed only by 0s, like 00000000-0000-0000-0000-000000000000.
A Guid is a struct , those can't be null. You need to use the nullable type.
A Guid. Empty has a value of 00000000-0000-0000-0000-000000000000. You can take advantage of an empty GUID to compare it with another GUID object to determine if it is non-zero.
As simple as this:
var guid = Guid.Empty;
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