VS 2010 vb.net: Details determine success or failure

Source: Internet
Author: User
Tags anonymous new features

VS2010 version of the launch, a lot of bright spots, in addition to the new features on the expansion, that is, in the three languages c#,c++,visual basic on the basis of the addition of the fourth largest language F #, in the in-depth aspects of language, is commendable, is experiencing a management famous: Details determine success or failure. Among them, Microsoft's own language is also the oldest basic momentum is still bujiandangnian, in the details of more humane, through a number of details can also be seen vs as a mature development tool began to form a technical breakthrough at the same time, in the details also began to fine treatment, the following to VB2010 as an example to explain.

First, remove the connector in the language

This is a small change on the surface, because basic developers know that the original basic does not support the line to write code, if the line is not complete, you need to underline the next row and the current row merge is a line of content, otherwise you need to write code as a row. Now in the new 2010, vb.net can directly support line wrapping. Seemingly simple small functions, so that the exchange of source code a lot of convenience, so that the program style more consistent, easy to understand.

Second, the lambda expression feature continues to expand

A Linq lambda expression is a language feature that, in many ways, is similar to an anonymous method, the most successful of which is the C # language, which passes strings, integers, reference types, and so on to methods so that they can manipulate those values. If a Linq lambda expression is first introduced into a language, then there is no need for anonymous methods. By using a lambda to treat code as data, a LINQ lambda expression in a new version extends the range of values, providing richer support for the lambda, which previously had only the function keyword, and now adds a sub keyword with no return value. The expansion of this function makes the transformation between language and language more and more simple on a platform of multiple languages, which is a great news for developers, because in addition to the underlying support of the platform, from the source code point of view, the cooperation between developers is becoming more and more simple and happy.

Third, the object-oriented implementation is simpler

Object reuse is an important idea in object-oriented, but sometimes it is not easy to realize. Because of the object's properties, the object-oriented process should not expose its own member variables, adding a member variable needs to write its properties, the code is very cumbersome. In the new version, this feature becomes exceptionally simple, as long as you write the attributes, and the compiler adds the member variables for you at compile time. Compared to the code, the new only need a row, and the old one needs n rows.

Old Code:

Private _FirstName As String
Property FirstName() As String
     Get
         Return _FirstName
     End Get
     Set(ByVal value As String)
         _FirstName = value
     End Set
End Property 

We don't have to write so much in VS2010, you can write new vb.net code as follows:

Property FirstName() As String
Property FirstName() As String = "George"

Object-oriented thinking is a good idea, but the realization of a very complex and very difficult to understand the idea, it is difficult to be promoted, the meaning of this improvement is to make the code concise, easy to cooperation between developers and exchanges.

Of course, vb.net2010 in the function is not so much, through the above several details, can enhance the confidence of developers to use, more can increase the confidence of beginners.

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.