Back to Home

C# GUID.Empty Explained — Empty, Default, and New Guid()
Guid.Empty is the zero-value GUID and is often used as a sentinel for “not assigned yet.” It is the clearest choice in most code when you want to indicate an unset identifier without using null.
Guid.Empty vs default(Guid) vs new Guid()
C# Example Code
Guid empty = Guid.Empty;
Guid defaultValue = default(Guid);
Guid created = new Guid();
Console.WriteLine(empty == defaultValue); // True
Console.WriteLine(empty == created); // TrueUse Guid.Empty when you want readable intent. default(Guid) is equivalent, but Guid.Empty makes the purpose obvious in reviews and guard clauses.
When to use it
C# Example Code
Guid customerId = Guid.Empty;
if (customerId == Guid.Empty)
{
Console.WriteLine("Customer ID has not been assigned yet.");
}Common pitfalls
Guid.Emptyis not the same asnullfor a nullableGuid?.- Prefer
Guidcomparisons over string comparisons when possible. - If you need true null semantics in an API, prefer
Guid?or a dedicated wrapper type.
FAQ
Is Guid.Empty the same as default(Guid)?
Yes. Both are all-zero GUIDs. Guid.Empty is more expressive.
Should I use Guid.Empty or null?
Use Guid.Empty when you want a value type to mean “unset.” Use Guid? when you need real null semantics.
Take It Further

The community's favorite C# guide — teaches every concept you just read about with clarity.
The C# Player's Guide — 5th Edition · RB Whitaker
Get it on Amazon →As an Amazon Associate I earn from qualifying purchases.