小编joh*_*ins的帖子

我可以将国家/地区设置为Bogus (C#)

我刚刚开始在 C# .net 5.0 中使用 Bogus。我设法在沙盒应用程序中返回非常有用的数据,但我想将数据限制为基于美国。有没有办法做到这一点?(这是我的沙箱应用程序的一部分)

using Bogus;

namespace FrankenPeople
{
    public class GetBogus
    {
        public enum Gender
        {
            Male,
            Female
        }

        private static int userId = 1;

        private static readonly Faker<Person> fakeData = new Faker<Person>()
            .RuleFor(p => p.Id, f => userId++)
            .RuleFor(p => p.Gender, f => f.PickRandom<Gender>().ToString())
            .RuleFor(p => p.Title, f => f.Name.Prefix(f.Person.Gender))
            .RuleFor(p => p.FirstName, f => f.Name.FirstName(f.Person.Gender))
            .RuleFor(p => p.MiddleName, f => f.Name.FirstName(f.Person.Gender))
            .RuleFor(p => p.LastName, f => f.Name.LastName(f.Person.Gender))
            .RuleFor(p => p.StreetAddress, f => f.Address.StreetAddress())
            .RuleFor(p => …
Run Code Online (Sandbox Code Playgroud)

.net c# country bogus

2
推荐指数
1
解决办法
5690
查看次数

标签 统计

.net ×1

bogus ×1

c# ×1

country ×1