Module vs Shared

  • Thread starter Thread starter Henrry Pires
  • Start date Start date
H

Henrry Pires

Hello to all

Does any one know what's the diference between have a function or sub in a
module, or has de same function or sub declared as shared in a class?
 
You can access the module method unqualified, while you must specify the
class name for shared methods in a class.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# or VB to C++/CLI
 
Henrry Pires said:
Does any one know what's the diference between have a function or sub in a
module, or has de same function or sub declared as shared in a class?

In addition to David's reply, note that you can add instance members to
classes but not to modules.

Personally I consider modules a loose grouping construct whereas classes
typically form entities having attributes and operations they can perform.
 
You can access the module method unqualified, while you must specify the
class name for shared methods in a class.
--
David Antonwww.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# or VB to C++/CLI






- Show quoted text -

You can also access the classes shared methods unqualified, just add
Import ClassNameSpace.ClassName
Then you can call the shared method like a modules method. The Modules
in VB.Net are actually static classes just like in C# , when you look
to the il side, they are implemented as static classes with private
constructors which prevents instance creation of them.
 
Back
Top