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.7+45c8d9adb5970d727cceec44a5ed61aea0016e50
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