Determines if a given country or region is associated with another specified country or region.
Parameters
- region
- The primary country or region to check for association.
- countryOrRegion
- The country or region to verify if it has an association with the first parameter.
Return Value
True if either is associated with the other as part of the same group; otherwise, false.
Demonstrate checking if a country is part of a region to apply tax rules:
var country = GeoLocation.Belgium;
var price = 100;
var tax = 0.0M;
if (EUTaxApplicable(country))
{
tax = 14.2M;
}
var total = (tax * price) + price;
public bool EUTaxApplicable(GeoLocation country)
{
var vatApplicable = GeoLocation.EUROPEAN_UNION.Contains(country);
return vatApplicable;
}
var country = GeoLocation.CzechRepublic;
var localShipping = GeoLocation.EUROPEAN_UNION.Contains(country) && country.Contains(GeoLocation.CENTRAL_EUROPE);
var euShipping = !localShipping && GeoLocation.EUROPEAN_UNION.Contains(country);
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2