首页 > 解决方案 > CS0029:无法在 C#/Specflow 中将类型列表转换为数组

问题描述

我收到以下错误:

错误 CS0029 无法隐式转换类型你能帮我解决它吗?我已经尝试了很多东西,但我无法解决..提前谢谢你。

标签: c#automated-testsspecflow

解决方案


似乎AddUpdateData是 type CountryStateData[],但您提供的是List<CountryStateData>.

所以提供一个数组

ManageCountryStatesData returnValue = services.BackendService.CountryManageCountryStates(services.ApiKey, services.SessionKey,
  new ManageCountryStatesOptions()
  {
    AddUpdateData = new CountryStateData[1] { myState }
  }); 

推荐阅读