我,在特殊情况下我不想使用 automepper,这是我从 Model 到 ViewModel 的转换方法:
public static BlogPostViewModel ConvertToBlogPostViewModel(this BlogPost blogPost)
{
var blogPostViewModel = new BlogPostViewModel
{
Body = blogPost.Body,
Summary = blogPost.Summary,
Title = blogPost.Title
};
return blogPostViewModel;
}
现在我可以如何为相同方法()的 IEnumerable 执行此操作!??
public static IEnumerable<BlogPostViewModel> ConvertToBlogPostViewModelList(this IEnumerable<BlogPost> blogPosts)
{
??
}
谢谢 !