【发布时间】:2010-08-20 04:20:31
【问题描述】:
我收到此错误:Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Partial Class _Default
Inherits System.Web.UI.Page
<WebMethod()> _
Public Shared Function ParseData() As String
Dim value as string = GetValue()
End Function
Private Function GetValue() as String
Return "halp"
End Function
End Class
我知道这与第一个函数是共享的,而第二个函数也应该是公共的这一事实有关,但我不完全理解其背后的原因。可能不相关,但我正在从一些 javascript 调用 web 方法。
【问题讨论】:
标签: asp.net vb.net static shared