我有一个巨大的资源邮箱列表,我正在从所有的日历项目。目前,为了将它们从FindItemResults<Appointment>转移到List<Appointment>,我做了以下工作:
FindItemsResults<Appointment> tApts = service.FindAppointments(CalendarFolderID, cv);
Collection<Appointment> tApts2 = tApts.Items;
List<Appointment> apts = tApts2.Cast<Appointment>().ToList();这是最好的方法吗?从FindITemResults -> Collection -> List上走似乎是相当多余的。
有办法绕过Collection<Appointment>转换吗?
发布于 2014-02-17 17:20:47
你应该能做这样的事:
FindItemsResults<Appointment> tApts = service.FindAppointments(CalendarFolderID, cv);
List<Appointment> apts = tApts.Items.ToList<Appointment>();Items属性是一个Collection<T>,只要您在cs文件中定义了using System.Linq;,就可以使用扩展方法执行using System.Linq;。
希望这能有所帮助。
https://stackoverflow.com/questions/21835007
复制相似问题