// The metadata needed by this class is the same for all regions sharing the same country calling // code. Therefore, we return the metadata for "main" region for this country calling code. private PhoneMetadata GetMetadataForRegion(string regionCode) { var countryCallingCode = phoneUtil.GetCountryCodeForRegion(regionCode); var mainCountry = phoneUtil.GetRegionCodeForCountryCode(countryCallingCode); var metadata = phoneUtil.GetMetadataForRegion(mainCountry); return(metadata ?? EmptyMetadata); // Set to a default instance of the metadata. This allows us to function with an incorrect // region code, even if formatting only works for numbers specified with "+". }
// The metadata needed by this class is the same for all regions sharing the same country calling // code. Therefore, we return the metadata for "main" region for this country calling code. private PhoneMetadata GetMetadataForRegion(String regionCode) { int countryCallingCode = phoneUtil.GetCountryCodeForRegion(regionCode); String mainCountry = phoneUtil.GetRegionCodeForCountryCode(countryCallingCode); PhoneMetadata metadata = phoneUtil.GetMetadataForRegion(mainCountry); if (metadata != null) { return(metadata); } // Set to a default instance of the metadata. This allows us to function with an incorrect // region code, even if formatting only works for numbers specified with "+". return(EMPTY_METADATA); }