用IronPython 调用C# 封装的接口,C# 接口中含有List<string> 参数,直接使用Python 的数组报错:expected List[str], got list
解决办法:
转化python 的数组为C# 的List<string>,步骤如下:
1.添加c#的引用
import clr
clr.AddReference('System.Collections')
from System.Collections.Generic import List
2.定义python 的数组
pyList=["aa","bb"]
3.转化python 的数组到C#的List<string>
csList=List[str](pyList)