Jen,
Modules in VB.Net are just a nice/simple way to do something else: create a
utility class. When you do:
Module Foo
public function DoSomething() as string
...
end function
end Module
it actually gets compiled as a class:
CLASS Foo
PRIVATE SUB NEW
END SUB
public SHARED function DoSomething() as string
...
end function
end CLASS
I've capitalized the difference between the two. It might even mark the
class as NotInheritable (I'm not sure, though it should), but that's really
beyond the point. What I'm trying to say is that a module is a
class...atleast a static/shared class. If you prefer to use one syntax over
another, I see little harm in that (though it might confuse C#/Java
programmers). The difference between the type of class a Module creates (a
static/shared class) and a normal "instance" class is that you never create
an instance of a module.
You would never do:
Dim myFoo as Foo = new Foo()
actually, you can't do this....you would only use it for utility purposes:
dim someValue as string = Foo.DoSomething()
whereas a normal class you create an instance:
dim user as User = new User()
user.UserId = 1
user.UserName = "asdas"
.....
Karl