Created
February 20, 2012 15:53
-
-
Save craigtp/1869812 to your computer and use it in GitHub Desktop.
Convert a GUID to a smaller (unique) GUID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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