首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将FindItemsResults<Appointment>转换为List<Appointment>

将FindItemsResults<Appointment>转换为List<Appointment>
EN

Stack Overflow用户
提问于 2014-02-17 17:01:18
回答 1查看 1.1K关注 0票数 0

我有一个巨大的资源邮箱列表,我正在从所有的日历项目。目前,为了将它们从FindItemResults<Appointment>转移到List<Appointment>,我做了以下工作:

代码语言:javascript
复制
    FindItemsResults<Appointment> tApts = service.FindAppointments(CalendarFolderID, cv);
    Collection<Appointment> tApts2 = tApts.Items;
    List<Appointment> apts = tApts2.Cast<Appointment>().ToList();

这是最好的方法吗?从FindITemResults -> Collection -> List上走似乎是相当多余的。

有办法绕过Collection<Appointment>转换吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-17 17:20:47

你应该能做这样的事:

代码语言:javascript
复制
FindItemsResults<Appointment> tApts = service.FindAppointments(CalendarFolderID, cv);
List<Appointment> apts = tApts.Items.ToList<Appointment>();

Items属性是一个Collection<T>,只要您在cs文件中定义了using System.Linq;,就可以使用扩展方法执行using System.Linq;

希望这能有所帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21835007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档