Csharp的“VB模块”版本 [英] Csharp's version of "VB Modules"
问题描述
这是我的故事,
当我使用VB在Access中编写函数时,我在模块中创建了函数,只需调用函数名称即可轻松访问它们。使用VB的Windows应用程序中存在相同的选项
选项模块当我右键单击项目并选择添加时出现在VB中但不在C#中
现在我使用C#创建Windows应用程序。
我的问题是,...
如果我想在不同的模块中分离我的功能在VB中,我应该创建什么,新类,新组件?
谢谢
Perry
Here is my story,
When I wrote functions in Access using VB, I created functions in Modules where I could access them easily by just calling the name of the function. The same option exist in Windows Application using VB
The option "Modules" appear when I right-click on the project and select "Add" in VB but not in C#
Now I create Windows Application using C#.
My question is, ...
if I want to seperate my functions in different "modules" as in VB, what should I create, a new class, a new component?
thanks
Perry
推荐答案
你的意思是课程?
Hehe为vb的奇怪命名惯例粉笔另外一个。
为你的项目添加一个新的类文件
You mean classes?
Hehe chalk another one up for vb''s strange naming conventions.
Add a new class file to your project
你的意思是类?
Hehe粉笔另一个对于vb'奇怪的命名约定。
为你的项目添加一个新的类文件
You mean classes?
Hehe chalk another one up for vb''s strange naming conventions.
Add a new class file to your project
是的,这是一个C#没有区分模块和类之间的区别但是VB的区域。它们确实有细微差别 - 例如,您可以在模块中调用方法而无需指定模块名称,而您不能使用类,并提供(虚拟)相同的功能,您将方法声明为共享公开的。你这样做的方法是使用共享方法,以便你可以使用以下概念调用它们(但显然在C#中)
VB
Yeah, this is one of those areas where C# doesn''t distinguish the difference between modules and classes but VB does. They do have subtle differences - for instance you can invoke a method within a module without having to specify the module name, whereas you can''t with a class, and to provide (virtually) the same functionality you declare a method as shared instead of just public. The way you would do this is using shared methods so that you can invoke them using the following concept (but obviously in C#)
VB
我不确定我看到你的VB代码和C#代码之间的区别?或者那就是重点?
我以为模块只是VBs的类似静态类的东西?
I''m not sure I see the difference between your VB code and the C# code? Or was that the point?
I thought "module" was just VBs way of like static class or something?
这篇关于Csharp的“VB模块”版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!