在VB2010中使用模块asp.net [英] use module in VB2010 asp.net

查看:89
本文介绍了在VB2010中使用模块asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我是初学者,我正在尝试设计一个简单的网站
我想创建一个在其中声明局部变量的模块
因为我不想每次都声明局部变量
我需要您的帮助

hello everyone
i''m beginner and i''m trying to design a simple website
i want to create a module to declare a local variables in it
because i don''t want to declare the local variables every time
i need your help please

推荐答案

这个问题确实很有意义;此外,我怀疑这是基于错误的术语.

首先,.NET支持模块,但是Visual Studio支持每个程序集仅创建一个模块(模块不是引用的程序集,模块是模块,是程序集的一部分-请继续阅读),因此您无法创建不代表整个装配体的单独模块.

.NET中的一个主要单元是程序集.程序集可以包含一个或多个可执行模块,每个模块由一个单独的文件表示.一个模块可以被多个组件使用.可以直接使用编译器创建此类多模块程序集,但Visual Studio不直接支持它. (但是,当然,如果已使用Visual Studio,则可以使用多模块程序集,可以在运行时使用Reflection标识模块,等等.)
现在,关于局部变量.无论哪种类型,您都不能创建任何不同的代码单元:用户定义的类型,模块或程序集,以便声明局部变量".局部变量是局部变量:唯一存在且在方法内部声明,不能在外部使用.因此,这个问题毫无意义.

顺便说一句,局部变量"一词本身是否足以暗示它?

—SA
The question does make much sense; besides, I suspect it''s based on just wrong terminology.

First of all, modules are supported in .NET, but Visual Studio supports creation of only one module per assembly (module is not a referenced assembly, module is a module, a part of assembly — keep reading), so you could not create a separate module which does not represent a whole assembly.

A main unit in .NET is the assembly. An assembly can consist of one or more executable modules, each module represented by a separate file. One module can be used by more than one assembly. Such multi-module assemblies can be created using a compiler directly, but Visual Studio does not support it directly. (But of course with Visual Studio one can use multi-module assemblies if they are already created, identify modules during run-time using Reflection, etc.)

Now, about local variables. You cannot create any distinct unit of code, not matter what kind: a user-defined type, a module or an assembly in order to "declare local variables". Local variables are local: the only exist and declared inside a method and cannot be used outside. Therefore, the question makes no sense whatsoever.

By the way, isn''t the term "local variable" itself suggestive enough to see it?

—SA


这篇关于在VB2010中使用模块asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆