Identify a Country’s Currency in C#
Attempting to navigate and cover the various facets of creating a website can be a struggle, especially if you are catering to an international client base. To assist in issues that may arise due to differences in currency, we have developed an API that will auto-populate a country’s currency, ISO code, and currency symbol when you input the country name.
We will begin the process by installing the .NET Framework SDK (.NET Core also available):
Install-Package Cloudmersive.APIClient.NET.Validate -Version 3.0.6
Moving on, we will be instancing the API and calling the function with the following code:
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.Validate.Api;
using Cloudmersive.APIClient.NET.Validate.Client;
using Cloudmersive.APIClient.NET.Validate.Model;namespace Example
{
public class AddressGetCountryCurrencyExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");var apiInstance = new AddressApi();
var input = new ValidateCountryRequest(); // ValidateCountryRequest | Input requesttry
{
// Get the currency of the input country
ValidateCountryResponse result = apiInstance.AddressGetCountryCurrency(input);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AddressApi.AddressGetCountryCurrency: " + e.Message );
}
}
}
}
In no time at all, you will receive a result that will display the aforementioned monetary details for the specified country. We hope this automation will aid in simplifying international business and improving experience from both an internal and external perspective.