日期:2012-07-07  浏览次数:20360 次

Building Classes and
Assemblies with VB.NET
During the last three or so years, most VB developers have
spent a great percentage of their time building COM compo-nents.
These components are used as the middle-tier compo-nents
in n-tier systems. The benefits of building n-tier
applications are well known, and include:
• Code reuse
• Elimination of many or all distribution headaches
• Encapsulation of business logic to control business
processes and access to databases
Not surprisingly, VB.NET lets you build components, but
they are no longer COM components. COM components
have certain elements such as class IDs (s), type
libraries, and interface IDs (s). Each class in a COM com-ponent
has to support IUnknown and IDispatch .
VB.NET refers to one or more classes compiled into a file as
a class library, rather than a COM component. Class libraries
are compiled into an assembly, which often has a .DLL exten-sion.
You can use the classes from the class library much like
you would the classes from a COM component: You instanti-ate
the objects in the client application and then call proper-ties
and methods and respond to events. However, assemblies
are not COM components; instead, they are .NET assemblies.
CHAPTER 4
Building Classes and Assemblies with VB.NET