/// <summary>
/// 获取随机码
/// </summary>
/// <param name="length">长度</param>
/// <param name="availableChars">指定随机字符,为空,默认系统指定</param>
/// <returns></returns>
private string GetRandomString(int length, string availableChars = null)
{
if (availableChars == null) availableChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var id = new char[length];
Random random = new Random();
for (var i = ; i < length; i++)
{
id[i] = availableChars[random.Next(, availableChars.Length)];
} return new string(id);
}