.NET Guid Formats

Posted by Joe Enos on January 18, 2021 · 1 min read

GUIDs can be a quick (but not secure) way to generate random values in .NET. You can use them in UNIQUEIDENTIFIER columns in SQL Server or the equivalent data type in other database systems.

The framework gives you a few formatting options, depending on what you need it for.

See the documentation for more about the format strings. Or read more than you ever could possibly want to know about GUID/UUID at Wikipedia.

View code on GitHub