• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C# Equivalent to VB Modules

The closest equivalent to a VB module is a static class in C#.  One difference is that VB allows you to specify module members from elsewhere in a project without qualifying the member call with the module name (Instant C# inserts these qualifiers into the converted C# code).

VB C#
Public Module ModuleTest
    Public Sub ModuleMethod()
    End Sub
End Module

Public Class UseModule
    Sub Method()
        ModuleMethod()
    End Sub
End Class
public static class ModuleTest
{
    public static void ModuleMethod()
    {
    }
}

public class UseModule
{
    public void Method()
    {
        ModuleTest.ModuleMethod();
    }
}


Use Instant C# and Instant VB to convert between VB.NET and C#.     

Additional resource: VB.NET and C# Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.