julianusti
3/25/2015 - 1:21 PM

gistfile1.cs

public string ResolveRegion(string countryCode, string stateCode) 
{
  return GetRegionCode(Validate(stateCode), Validate(countryCode)) ?? string.Empty;
}

public string GetRegionCode(string stateCode, string countryCode)
{   
  return RegionMapping[countryCode][stateCode] ?? RegionMapping[countryCode][string.Empty];
}

public string Validate(string val)
{
  return string.IsNullOrEmpty(val) ? string.Empty : val.ToUpper();
}