【发布时间】:2017-09-23 14:44:51
【问题描述】:
我想使用“UTorrentClientApi”。在github上看到它:
https://github.com/latop2604/UTorrentClientApi
在 github 上他告诉我们如果要获取 Torrent 列表,我们必须使用这 3 行代码:
UTorrentClient client = new UTorrentClient("admin", "password");
var response = client.GetList();
List<Torrent> torrents = response.Result.Torrents;
我收到此错误:
无法将类型“system.collection.generic.IList”隐式转换为“System.Collections.Generic.List”。存在显式转换(您是否缺少强制转换?)
当我使用“var”时,我没有收到错误。但我看不到结果
那么我能做些什么来解决这些问题呢?
【问题讨论】:
-
不要发布代码链接,也不要发布代码图片 - 将相关代码直接插入您的问题中
-
另外你想要(并且不显示在这个问题中)是加入列表的元素(例如:使用
String.Join)而不是使用.ToString() -
在 Result.Torrents 之后添加 .ToList() 以从 IList 转换为 List