I am confused with the implementation of Static in VB.NET. In C #, we can create static classes and static methods for writing utility methods for our application.
Now VB.NET allows us to create a Module instead of a static class. If we create a method in a module, by default it will become static. But in my application, I wrote the code below:
Public Class Utility Public Shared Function GetValue() As String // My code End Function End Class
By writing code, I can access the utilitarian method as Utility.GetValue() . Since this is not a static class, I have to instantiate the object. But this method is available for both the class and the Utility objects.
Now my questions are:
- Is the implementation I made that could violate any of the functions of the static class that this module provides?
- What is the difference between this and module implementation?
- If I create a module, will the scope be the same as this class? I want to access the method throughout the project, as well as other projects referenced by this.
I tried several articles, but did not find exact answers anywhere. Please, help.
Atanu roy
source share