question

AndersonRodriguesCavalcante-1548 avatar image
0 Votes"
AndersonRodriguesCavalcante-1548 asked RoyLi-MSFT commented

Windows provides country code C#

Is there any Windows API that I can get the country code of the phone number in C#? Some code I receive country code Windows region phone number. Windows itself provides me with this information.

dotnet-csharpwindows-uwp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AndersonRodriguesCavalcante-1548 Any updates about this? Does Nico's reply helps?

0 Votes 0 ·

1 Answer

NicoZhu-MSFT avatar image
1 Vote"
NicoZhu-MSFT answered

Hello,
Welcome to Microsoft Q&A!

I

s there any Windows API that I can get the country code of the phone number in C#?

Sure, you could use PhoneNumberInfo class to get your country with your phone number.

For example:

 var phonenumberinfo = new PhoneNumberInfo("176xxxxxxxx");
 var countryCode = phonenumberinfo.CountryCode;

Thank you.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.