コード例 #1
0
ファイル: Address.cs プロジェクト: workcontrolgit/Bogus
 /// <summary>
 /// Get a random ISO 3166-1 country code.
 /// </summary>
 public string CountryCode(Iso3166Format format = Iso3166Format.Alpha2)
 {
     if (format == Iso3166Format.Alpha2)
     {
         return(GetRandomArrayItem("country_code"));
     }
     if (format == Iso3166Format.Alpha3)
     {
         return(GetRandomArrayItem("country_code3"));
     }
     throw new ArgumentException("Invalid country code", nameof(format));
 }
コード例 #2
0
 public IActionResult CountryCode(Iso3166Format format) =>
 Result(Faker.Address.CountryCode(format));