Chapter 4 Building Classes and Assemblies with VB.NET
点击次数:40 次 发布日期:2008-11-06 08:07:07 作者:源代码网
|
源代码网推荐 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 源代码网推荐 源代码网供稿. |
