/// <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)); }
public IActionResult CountryCode(Iso3166Format format) => Result(Faker.Address.CountryCode(format));