Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would be considered a VB.NET module in C#?

Tags:

c#

vb.net

VB.NET has classes and Modules, so my first question is what is the difference? Also, I noticed that C# does not have modules, but just classes, is there something in place of modules or were they removed for C#?

like image 680
Xaisoft Avatar asked Mar 16 '11 21:03

Xaisoft


People also ask

What is a VB module in C#?

In VB, a module is used to store loose code accessible from elsewhere in the application without having to first initialize something. The state of the variable can be easily set or changed and that continues to carry on that value throughout. For the same work in C#< use a static class.

What are .NET modules?

ASP.NET MVC Modules is an open-source framework for web development in . NET written in C#. It allows packing all resources in the DLL: CSS, views, icons, and scripts with fallback to the Areas for possible overrides.

How many types of modules are there in VB?

The three kind of modules are Form Modules, Standard Modules and Class Modules.


1 Answers

About the closest thing to a VB module would be a static class in C#.

For Example:

In VB.NET

Module SomeModule
    Public Sub DoSomething
        MsgBox("Doing something!")
    End Sub
End Module

Same thing in C#:

public static class DoSomethingFuncs
{
    public static void DoSomething() {
        MessageBox.Show("Doing something!");
    }
}
like image 180
squillman Avatar answered Oct 14 '22 14:10

squillman