python 泛型_Python插件 - 如何创建C#泛型List
生活随笔
收集整理的這篇文章主要介紹了
python 泛型_Python插件 - 如何创建C#泛型List
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題來源: 今天在用Python插件調用函數SendMailServiceHelper.GetUserContacts(Context ctx, List userIds)時,使用如下代碼報錯:expected List got list。lst=[10086,10087,10088];
SendMailServiceHelper.GetUserContacts(ctx,lst);
解決辦法: 引用System.Collections.Generic,參考代碼如下:import?clr
clr.AddReference("System")
from?System.Collections.Generic?import?*
def?BarItemClick(e):
if?e.BarItemKey.upper()?==?"TBTESTMAIL":
ids=List[Int64]();
ids.Add(10086);
ids.Add(10087);
ids.Add(10088);
result1=SendMailServiceHelper.GetUserContacts(ctx,ids);
擴展知識:Python的其它常用基本類型:?str, int, long, float, bool。
總結
以上是生活随笔為你收集整理的python 泛型_Python插件 - 如何创建C#泛型List的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大一java期末考笔试_大学java期末
- 下一篇: 进度条设置_朋友圈可以设置quot;仅一