To elaborate on VB. NET (top)

Source: Internet
Author: User
Tags exception handling garbage collection inheritance new features requires thread versions visual studio
To elaborate on VB. NET (top)
(Author: Green Apple Studio compiled March 07, 2001 14:47)

Proposed by Microsoft Corporation. NET concept, is infiltrating into our life from all aspects. The role it will produce, as one industry expert describes: "Please forget what you think you know." NET will change everything! " That being the case, it is necessary to quickly grasp the implications and far-reaching implications of this new concept, both in the IT industry and in business decision makers.

Profile
VB is constantly developing, it has the previous VB programmers dream all want to have the performance, imagine you will be arbitrary use of these performance, is it exciting? However, the VB version, which is scheduled to be marketed in the fourth quarter of 2001, may be a little tricky because it takes a long learning cycle to fully master it, and includes subtle changes that you may have made when using them.

Conditions to prepare: it is recommended that you obtain a beta version of Visual Basic.NET, which is useful for all VB programmers.

Microsoft. NET platform covers a wide range, and it is difficult to predict its true meaning. We've noticed that there's a lot of about. NET's incorrect understanding. So in this article, we're going to give you an idea of what vb.net is, what it is, what it can do, and how it can be fully brought to its advantage. We'll take a special look at the changes in the IDE, object-oriented features, changes to the underlying structure, some "modern" syntax, and enhancements to packaging and distribution. We will discuss what these features can do for you, explaining their strengths and weaknesses. Since these changes are so great and involved in all aspects, it is unrealistic to hope that this article will satisfy all your requirements, and to understand all of this knowledge please refer to the articles and books.

Visual Basic.NET is completely different from the development tools you know now, and this new version will change your future. How much different is it? If you feel that moving from VB3 to VB4 is a big change, this vb.net will be a shock to you. The upgrade is not so much a new version of VB as it is migrating to a new platform, and you are facing the same situation as migrating from DOS to Windows.

VB acquired the ability to inherit
Vb. NET is expected to have the first new function is the ability to inherit. Inheritance is a function that VB developers have been demanding most for a long time. It would be interesting to judge whether the requirement for inheritance was as much fun as the requirement for a localized compiler earlier, when Microsoft offered one, you could hardly hear much of it.

Visual Basic is now a real object-oriented language. In the past, you can create pseudo implemented object inheritance by using the interface inheritance of VB, but you don't have to do that now.

Visual Basic.NET now offers a large number of object-oriented features, including application inheritance, which allows you to export the classes you want to create from other classes. As in other object-oriented languages, you can override the methods and properties of the base class and implement polymorphism to create robust, extensible components. For example, suppose you inherit a forklift class from the base class crane, you can override the default implementation of the lift method in the base class with code like the following:

Public Class Forklift

Inherits Crane

Overrides Sub Lift (ByRef _

Height as Double)

Height = height + 10

End Sub

End Class

Vb. NET allows you to override methods or attributes, and it allows you to overload the method. Overloading is the ability to define methods or properties with the same name, but with different data types. For example, suppose you have a component that sorts arrays of different data types, and you don't need three different names (one for each data type); You can actually overload a method name:

Overloads Sub Sortarray (ByRef _

Avalues () as String)

...

Overloads Sub Sortarray (ByRef _

Avalues () as Integer)

...

Overloads Sub Sortarray (ByRef _

Avalues () as Object)

Another change: The form is now a class module. This means that the class itself contains code to create all the "fertilizers" for the form. You may wonder why you have to see these previously unused code, but this change also brings powerful new features, including the ability to inherit these forms. Microsoft calls this technology visual inheritance. Assuming that your dialog box has a standard format, such as a line of buttons on one side of the form and an identifier on the corner, you can create a form template (Class) by visualizing inheritance and export the form you want from the base class.

Everything is an object.
Code reuse simplifies the development process, enabling simpler, more powerful code reuse, such as implementing and visualizing inheritance. However, code reuse does not end here. You can inherit classes defined in other Vs.net languages by supporting the vb.net common language runtime (Common Language runtime-clr). For example, you or someone else creates a C # class, and then you can inherit it from VB.

VB.net's object-oriented capabilities extend the path of the language itself: everything is an object. This means that you gain more intrinsic functionality than in previous versions of VB, and you will rarely be forced to use Windows APIs. For example, in previous versions of VB, you used the LoadPicture method to load pictures and draw lines using the line method of the form (or the faster API). Now you use the System.Drawing object to create and work with graphics. You can use the following code to display a picture on the form:

Picshowpicture. Image = _

System. Drawing.Image.FromFile (_

"C:\test.bmp")

Note that vb.net's "Everything is the object" way to make your statement more permanent.

Consider the following statement, which paints a yellow-green line on a drawing object:

Objgraphics. DrawLine (System. Drawing. _

Pens.chartreuse, 0, 0, 100, 100)

These long statements also have benefits: improved functionality, adaptability, and ease of use. Once upon a time, you had to dig through documents to achieve advanced functionality, often having to resort to APIs. Now, the associated feature set is logically contained in the object. Another benefit of this approach is that the class organizes the related functions well. So it's actually interesting to look at the objects you're interested in and find out what they do.

Visual Basic.NET's object-oriented capabilities offer a number of real benefits. In many cases, vb.net's object-oriented nature and the inherited performance of implementations help you create specific types of functionality more easily and quickly than in previous versions of VB. However, you don't have to use inheritance or other. NET functionality just because you can. The new features of vb.net make it easier to develop many types of applications! However, as with all language abilities, you need to use the functions that are best suited to a particular situation.

The danger of free threading
You may need to give a special warning for free threads. VB6 allows you to create multithreaded server programs using separate threads, but VB never used to allow you to create free thread client programs. VB.net changed all of this. Creating a free-threaded application is now almost the smallest thing. In fact, I reckon that programmers who don't understand the nuances of their applications will have a lot of problems adding free threads to their apps. It takes just a few lines of code to start a new thread: simply pass the address of the thread object to the method, and the method itself starts the threads. This is really cool and useful, but you need to be careful: These features apply to specific situations, and it's your business to determine which ones are applicable and use them wisely. Many developers use inheritance and free threads to find themselves in a lot of trouble, please don't let this happen to you.

Perhaps the most discussed vb.net feature is the CLR (the common language runtime), where VB runs on top of it. Is that the CLR provides many of the key features of vb.net. For example, the CLR makes implementation and cross-language inheritance as well as free threading possible.

Distributed VB program requires you to distribute VB Run-time Library, in the VB6 is Msvbvm60.dll. Many other languages also have similar requirements, including C + + and Java. In Visual Studio.NET, all visual Studio languages share the same runtime: the CLR. Here are a few big changes, and first, all Visual Studio languages now share the same IDE, the same form engine, the same exception handling mechanism, and so on. This means that Visual Basic and languages like C # have the same status, at least almost equally.


>>>>> Next: Intermediate languages that are easy to decompile, garbage collection requires a new architecture, the SET statement disappears

>>>>> last page: forms and new IDE faces, creating a compiled server-side code, the right path



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.