C# Umbraco:如何使用IEnumerable IPPublishedContent对象填充ViewModel?

C# Umbraco:如何使用IEnumerable IPPublishedContent对象填充ViewModel?,c#,model-view-controller,umbraco7,C#,Model View Controller,Umbraco7,我觉得这可能是直截了当的,但我已经挣扎了几个小时。我需要将项目列表传递给视图模型。这些项目最初是使用Umbraco的CurrentPage API检索的。这将返回需要强制转换的IPPublishedContent对象。有人能告诉我如何做到这一点吗 型号: public class BlogsViewModel { public new IEnumerable<BlogsViewModel> Blogs { get; set; } public new strin

我觉得这可能是直截了当的,但我已经挣扎了几个小时。我需要将项目列表传递给视图模型。这些项目最初是使用Umbraco的CurrentPage API检索的。这将返回需要强制转换的IPPublishedContent对象。有人能告诉我如何做到这一点吗

型号:

public class BlogsViewModel 
{
    public new  IEnumerable<BlogsViewModel> Blogs { get; set; }

    public new string Category { get; set; }
}    
我知道我需要映射到一个列表,然后填充视图模型,但不断出现转换错误:

Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>' to 'System.Collections.Generic.IEnumerable<Library.ViewModels.BlogsViewModel>'. An explicit conversion exists (are you missing a cast?)
无法将类型“System.Collections.Generic.IEnumerable”隐式转换为“System.Collections.Generic.IEnumerable”。存在显式转换(是否缺少强制转换?)
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>' to 'System.Collections.Generic.IEnumerable<Library.ViewModels.BlogsViewModel>'. An explicit conversion exists (are you missing a cast?)