سؤال

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 ?

هل كانت مفيدة؟

المحلول

As simple as this:

var guid = Guid.Empty;

نصائح أخرى

Just create a new Guid

var guid = new Guid();

I know this is old, but this also works:

Guid guid;

Just to make sure PowerShell is here:

> [Guid]::Empty

Guid
----
00000000-0000-0000-0000-000000000000
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top