Skip to content

GuidExtensions

GUID manipulation and encoding extension methods.

API Reference

MethodReturnDescription
IsEmpty(this Guid)boolTrue if Guid.Empty
IsNotEmpty(this Guid)boolTrue if not Guid.Empty
IsNullOrEmpty(this Guid?)boolTrue if null or empty
HasValue(this Guid?)boolTrue if has non-empty value
NullIfEmpty(this Guid)Guid?Null if empty
OrEmpty(this Guid?)GuidGuid.Empty if null
OrNew(this Guid)GuidNew Guid if empty
ToShortString(this Guid)stringBase64 URL-safe encoding
FromShortString(string)GuidParse from short string
TryFromShortString(string, out Guid)boolTry parse
ToStringNoDashes(this Guid)stringN format without dashes

Released under the MIT License.