在我的 .NET 网站上包含类文件和结构定义的正确方法是什么?

发布于 2024-12-29 07:02:45 字数 667 浏览 4 评论 0原文

我在 .NET 中构建网站,而不使用 Visual Studio。

虚拟包含是包含我的类定义文件的正确方法吗?

例如,我的页面的前几行如下所示:

<!--#include file="classDefinition.aspx"-->
<!--#include file="anotherClassDefinition.aspx"-->
<script language="VB" runat="server">

     'page load sub, etc

在 classDefinition.aspx 中,我在类外部定义了一个结构。 classDefinition.aspx 的前几行如下所示:

<script language="VB" runat="server">

Structure loginInfo
    public loginID as string
    public somethingElse as string
    public permissions as hashtable
End structure

当我尝试在 anotherClassDefinition.aspx 中将私有成员声明为 loginInfo 时,出现类型未定义错误。为什么会发生这种情况?

I build sites in .NET without using Visual Studio.

Are virtual includes the right way to include my class definition files?

For example this is what the first few lines of my page look like:

<!--#include file="classDefinition.aspx"-->
<!--#include file="anotherClassDefinition.aspx"-->
<script language="VB" runat="server">

     'page load sub, etc

In classDefinition.aspx, I have defined a structure outside of the class. The first few lines of classDefinition.aspx look like this:

<script language="VB" runat="server">

Structure loginInfo
    public loginID as string
    public somethingElse as string
    public permissions as hashtable
End structure

I am getting type not defined errors when I try to declare a private member as loginInfo in anotherClassDefinition.aspx. Why is this happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对风讲故事 2025-01-05 07:02:45

您应该在 App_Code 目录中创建普通的 .vb 文件。
您不需要在任何地方包含任何内容。

You should create ordinary .vb files in the App_Code directory.
You don't need to include anything, anywhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文