Choose vb.net or C # (turn)

Source: Internet
Author: User
Tags case statement
Object-oriented programming will inevitably appear in the. NET in the world. Now the question is, which language do we choose?

(Flying knife Preface: If you are a VB programmer, then this article will introduce to you vb.net and previous version VB difference, if you are C #, C++,c,java programmer, this article is best not to look, this article's author's some views will let us these programmers spit blood)

In vb.net, Microsoft has given the VB programmers the dream for many years, that is, the real object-oriented programming language. Perhaps you have heard, VB. NET and his predecessor VB is very different, even you will not know it. Indeed, they have to delete some small things, while changing some objects, attributes and methods, but these are not a big problem for a VB programmer. In fact, I think that once you have been able to use vb.net skillfully, you will find it simpler and more intuitive than previous versions of VB. Because in learning vb.net road to go a lot of detours, so I think you may have a curiosity about C #, calculate whether need to give up VB.
 

If you are a VB programmer now, and have a certain time, then you do not need to choose other languages, such as C # or Delphi. You will find that although VB has changed a lot, but its core depends on. The main changes are in the use of objects, properties, and methods in vb.net. No matter what you learn. NET programs, all of which need to be learned again.

If you start using the basic language from the DOS era, then vb.net will take a hit. Vb. NET has removed the gosub,while/wend and some other stale statements. But Microsoft has issued a warning against using unstructured statements under any circumstances.

Advantages of vb.net
 

VB.net owns features, and C # doesn't. For example, the IsDBNull () function exists only in vb.net,c# and is not absent.

Vb. NET has ReDim for power functions and for reassigning array spaces, which are not in C #. C # is sensitive to capitalization, and most VB programs are not accustomed to case-sensitive. Personally, I like the IF in VB .... End If and do ... Loop rather than C # in the {} symbol. The Select Case statement is also simpler and more compact than a switch statement in C #. In C #, you have to use the break statement to abort the query structure. In VB, you can use case 1 to 50, but in C # you have to use 50 separate case statements to complete.
 

When you use the features of the object in VB, you will find inherits,moustinherit,notinheritable,overridable and some other keywords. In C #, you have to invoke some vague keywords and syntax, such as in vb.net, to inherit a class that you can write:

Public Class Person
...
End Class
Public Class Employee
Inherits person
...
End Class

If you use C #, you must:

public class Person
{
Public person () {
...
}
}
public class Employee:person
{
Public Employee () {
...
}
}

If you are not careful, you may forget to use the Employee:person syntax to inherit the person class.

(Flying knife Note: This author is a typical VB programmer, hehe, did not think of the advantages of the C # knife, all by this author denied. In these above the personal view of flying knives and this author is different, in fact, as long as we are accustomed to, you will find how easy C # is good. If everyone is from VB to C #, then there will certainly be some not adapt, but also not to the point of total negation, hehe, good habits.

How difficult is it to upgrade to vb.net?

Transplanting from VB6.0 to vb.net is not without challenge. But here are some things that we have to be prepared for: first, use classes, COM components, and the development of recursive routing techniques. If you use these programs to develop constructs, your porting efforts will be simple. There are some program styles that are not easy to migrate, such as zero groups, implied variables (that is, not using option Explicit), and Jet or RDO.

Introducing C #

Microsoft has two ideas when it comes to creating C #: First, you need a Java competitor, and Microsoft needs a Java-like language that absolutely belongs to the company. The other is that Microsoft wants a new, neat language.

C # is suitable for those Java, C, and C + + programmers who are already accustomed to the structure of the language and the sensitivity to case sensitive features. They also have to learn from the start. NET's class library, so at this time they are no more than VB programmers have many advantages.
 

The advantages of C #

I'm undeniably a supporter of VB, but C # does have some advantages, such as multiline annotations, and some shorthand for code:

intvalue--
intvalue-


Other C # 's advantages are that in the beta version of the document, C # has more data than VB.

Although it is not often used to write commercial applications, C # supports pointers. In this respect C # does have some small advantages over VB. However, in my program, I rarely use pointers.

(Flying knife Note: May be I translate the error, pointer whether the pointer, if it is, the author has made a big mistake, that is, C # does not support pointers, and do not know whether the author has used vc#, how can I say C # does not often write commercial applications? )


C # has the ability to use unsigned data types, and it is not widely used in commercial applications.
 

The way to transplant

The road from VB6 to vb.net is not smooth, but I think the investment is worthwhile for you to learn a new programming language. In learning, I recommend that you learn the procedural ways of objects in your face. You'll always be in. NET programming world is often used to it.


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.