G
Guest
Is that true you can't have a static method in VB.NET?
Public Static Sub Initialize() -- ???
thanks
Mark
Public Static Sub Initialize() -- ???
thanks
Mark
Cor Ligthert said:Mark,
Visual basic had not to do with old legacy names from C.
Therefore is there a name used which describes this better.
Public Shared Sub etc.
I hope this helps,
Cor
I think that you can't declare a class as shared, but if everything inMark,
Visual basic had not to do with old legacy names from C.
Therefore is there a name used which describes this better.
Public Shared Sub etc.
I hope this helps,
Cor
dgk said:I think that you can't declare a class as shared, but if everything in
it is shared then the class is, in reality, shared. Please correct me
if I'm wrong on this.
Cor Ligthert said:Visual basic had not to do with old legacy names from C.
Mythran,
| Well, in VB, you can...use Module...which, in turn, is a static class
Unfortunately a Module has the added "annoyance"/"feature" of being
implicitly imported, where as C#'s static class needs to be explicitly
qualified.
If you like the convenience of implicit imported, then using a Module for a
static class is good, however I find needing to qualify the identifiers of a
static class to be more beneficial. As I then know where the identifier is
coming from.
For example:
Debug.WriteLine(...)
You know that the WriteLine is part of the Debug class, rather then:
WriteLine(...)
You don't know if WriteLine is part of System.Diagnostics.Debug,
System.Console, a base class, a Module, or something else...
I normally reserve Module's for truly global identifiers, such as math
functions. I see some benefit in having System.Math being a module, however
its easy enough to import System.Math to gain unqualified access to its
identifiers...