Skip to content

Instantly share code, notes, and snippets.

@icalderond
Created August 23, 2019 20:58
Show Gist options
  • Save icalderond/24268a647fe61e49ce5b16a8737eb649 to your computer and use it in GitHub Desktop.
Save icalderond/24268a647fe61e49ce5b16a8737eb649 to your computer and use it in GitHub Desktop.
Generar una cadena de caracteres aleatoria
private string GetStringByCharacterCount(string cadena, int cantidadCaracteres)
{
if (cadena.Length >= cantidadCaracteres)
return cadena.Substring(0, cantidadCaracteres);
else
return GetStringByCharacterCount(cadena + Guid.NewGuid().ToString(), cantidadCaracteres);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment