Created
August 23, 2019 20:58
-
-
Save icalderond/24268a647fe61e49ce5b16a8737eb649 to your computer and use it in GitHub Desktop.
Generar una cadena de caracteres aleatoria
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
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