SourceExpress.ShorterGuid 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SourceExpress.ShorterGuid --version 1.0.1
NuGet\Install-Package SourceExpress.ShorterGuid -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SourceExpress.ShorterGuid" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SourceExpress.ShorterGuid --version 1.0.1
#r "nuget: SourceExpress.ShorterGuid, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SourceExpress.ShorterGuid as a Cake Addin
#addin nuget:?package=SourceExpress.ShorterGuid&version=1.0.1

// Install SourceExpress.ShorterGuid as a Cake Tool
#tool nuget:?package=SourceExpress.ShorterGuid&version=1.0.1

SourceExpress.ShorterGuid

This library contains extension methods ToShorterString() for Guid and FromShorterString() for String. It generates a 26 character string from the Guid, which is URL-safe and case-insensitive!

Inspired by CSharpVitamins.ShortGuid which uses Base64 encoding and produces 22-character string, however this library uses Base32-ish encoding, and only uses the following character set: 012345abcdefghijklmnopqrstuvwxyz.

Available on NuGet. To install, run the following command in the Package Manager Console:

PM> Install-Package SourceExpress.ShorterGuid

The Gist

It takes a standard guid like this:

b392ebf5-88d3-49b9-9ad8-1d4a73431787

and shortens it to a smaller string like this:

yrpt5gynl2wonaqs3p5baksrkw


Using the ShorterGuid

The ShorterGuid provides an extension method for Guid class:

var guid = Guid.NewGuid();  // b392ebf5-88d3-49b9-9ad8-1d4a73431787
var shorterGuid = guid.ToShorterString(); // yrpt5gynl2wonaqs3p5baksrkw

If you need to get Guid from the ShorterGuid string, you can do that using second extension method:

var shorterGuid = "yrpt5gynl2wonaqs3p5baksrkw";
var guid = shorterGuid.FromShorterString(); // b392ebf5-88d3-49b9-9ad8-1d4a73431787

Methods contain some internal error handling like wrong character or incorrect length of the ShorterGuid. See test project for more details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 2,999 11/9/2022
1.0.1 448 11/6/2022
1.0.0 433 11/6/2022

- 1.0.1 Fixed nuget configuration
- 1.0.0 Initial release.