Skip to content

Instantly share code, notes, and snippets.

@nordinrahman
Created July 27, 2017 09:09
Show Gist options
  • Save nordinrahman/9787b00cf141417ca2e067e2fb641fd9 to your computer and use it in GitHub Desktop.
Save nordinrahman/9787b00cf141417ca2e067e2fb641fd9 to your computer and use it in GitHub Desktop.
Get new compact and url friendly base64 representation of new guid
public string GetUniqueId()
{
return Convert.ToBase64String(Guid.NewGuid().ToByteArray())
.Replace('+', '-')
.Replace('/', '_')
.TrimEnd('=');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment