Xaisoft
Xaisoft

Reputation: 46591

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

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#?

Upvotes: 18

Views: 15814

Answers (1)

squillman
squillman

Reputation: 13641

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!");
    }
}

Upvotes: 33

Related Questions