Iso3166FromPhoneCode Method

Looks up the country represents by its phone code

Definition

Namespace: MobileTrack.Common.Models
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.8+34f1bbd8dc6b32752cfce829cbed66e15113d7ba
public static Iso3166Country? FromPhoneCode(
	string phoneCode
)

Parameters

phoneCode  String
The national phone code (or one of its phone codes)

Return Value

Iso3166Country
The country representing the phoneCode

Remarks

It grabs the longest dial code it can find; this is because of North America's 1, which is also used in other countries, so in those cases we apply the region code to the nation code; If, therefore, we get multiple results, the longest one is the correct one.

Exceptions

InvalidOperationExceptionNo element satisfies the condition in phoneCode

See Also