我在返回视图(viewModel)上收到错误消息,其中显示"''是一种类型,不能用作表达式。"我该如何解决这个问题?
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
答案 0 :(得分:2)
View()
类中定义了Controller
函数
如果您的类未继承Controller
,则会发生此错误。