Skip to content

Instantly share code, notes, and snippets.

@craigtp
Created February 20, 2012 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigtp/1869812 to your computer and use it in GitHub Desktop.
Save craigtp/1869812 to your computer and use it in GitHub Desktop.
Convert a GUID to a smaller (unique) GUID
public static string GuidToShortGuid(Guid gooid)
{
string encoded = Convert.ToBase64String(gooid.ToByteArray());
encoded = encoded.Replace("/", "_").Replace("+", "-");
return encoded.Substring(0, 22);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment