我有一个非常简单的类,位于我的VS2008 Web应用程序项目的App_Code文件夹中.我试图从我的代码隐藏文件中实例化此类的实例. Intellisense似乎没有看到我的课,我不知道为什么.我使用的是VB.NET,与C#相比,我认为它并不熟悉.也许我错过了一些东西.我敢打赌它与我在VB.NET中缺少的东西有关.
这是我的简单类(用于测试):
Public Class mySimpleClass 'Private member variables whose data is obtained from user input Private mUserID as String 'Class Properties Public Property UserID() as Integer Get Return mUserID End Get Set(ByVal Value as Integer) mUserID = Value End Set End Property 'Class Methods Public Function DisplayUserID() as String Return this.UserID End Function End Class
这是我如何尝试从代码隐藏实例化它…
Partial Public Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load Dim obj As New mySimpleClass() End Sub End Class