很抱歉这里是完整的代码.....我想传回全名和缩写
public static Dictionary> CountryStates {get;组; }
public CustomerUpdateDemographics()
{
if (CountryStates == null)
{
using (var service = new IQPWebServiceClient())
{
ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, erros) => { return true; };
service.ClientCredentials.UserName.UserName = "";
service.ClientCredentials.UserName.Password = "";
var response = service.GetCountryStates();
if (response.ReturnStatus.StatusCode == 0)
{
CountryStates = new Dictionary<string, List<string>>();
foreach (var countryState in response.CountryStates)
{
if (!CountryStates.ContainsKey(countryState.CountryCode))
CountryStates.Add(countryState.CountryCode, new List<string>());
CountryStates[countryState.CountryCode].Add(countryState.StateCode);
}
}
}
答案 0 :(得分:4)
你想要从函数中返回两个字符串吗?
KeyValuePair<string, string>
将是合适的类型。
答案 1 :(得分:2)
ToList?
return CountryStates.ToList();