Convert ObjectResult<string> to ObjectModel.Collection

本文关键字:to ObjectModel Collection gt string lt Convert ObjectResult | 更新日期: 2023-09-27 18:18:48

我的数据契约中有一个数据成员的类型是System.Collections.ObjectModel.Collection<string>。在执行函数导入后,我得到了ObjectResult<string>类型的结果。如何将objectresult<string>转化为ObjectModel.Collection<string>。有直接演员吗?

Convert ObjectResult<string> to ObjectModel.Collection

ObjectModel.Collection<string> col = new ObjectModel.Collection<string>(objectResult.ToList());