How can I generate random alphanumeric strings?

后端 未结 30 2774
予麋鹿
予麋鹿 2020-11-22 03:17

How can I generate a random 8 character alphanumeric string in C#?

30条回答
  •  无人及你
    2020-11-22 04:05

    There is one of the awasome nuget packages that make this so simple.

    var myObject = new Faker()
    .RuleFor(p => p.MyAlphaNumericProperty, f => f.Random.AlphaNumeric(/*lenght*/ 7))
    .Generate();
    

    One of the good example is here.

提交回复
热议问题