1

我在 Return View(viewModel) 上收到一个错误,上面写着“'View' 是一种类型,不能用作表达式。” 我怎样才能解决这个问题?

Function ShowFeed() As ActionResult

    Dim feedUrl = "somefeedurl"
    Dim feed As SyndicationFeed = GetFeed(feedUrl)

    ' build a view model
    Dim viewModel = New RssModel()
    viewModel.Title = feed.Title.ToString
    viewModel.Description = feed.Description.ToString
    viewModel.Link = feed.Links.ToString

    Return View(viewModel)

End Function
4

1 回答 1

2

View()函数在Controller类中定义。
如果您的类不继承,则会发生此错误Controller

于 2012-08-14T13:36:35.060 回答