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#?
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.
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.
The three kind of modules are Form Modules, Standard Modules and Class Modules.
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!");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With