Code Conversion between VB.net and C #

Source: Internet
Author: User
Recently, I want to change a component written in C # To VB.net. Since I was not very familiar with VB, I found that many corresponding writing methods should be checked and there is no comparison table, it was very troublesome to query. After consulting, I thought about it and asked if there was a table of the corresponding syntax between VB.net and C #. I thought about the following address:

Http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html

VB. NET and C # comparison

Considering that the page is slow to open, I added it to my favorites at the same time.ArticleInside: connected:

Http://blog.joycode.com/ghj/posts/15091.aspx

Some C #CodeThe Conversion Tool with VB.net code can be viewed at the following address:

Http://authors.aspalliance.com/aldotnet/examples/translate.aspx
Http://www.kamalpatel.net/ConvertCSharp2VB.aspx
Http://www.ragingsmurf.com/vbcsharpconverter.aspx
Http://w1.311.telia.com /~ U31115556/DESC/programs.htm
Http://expert.csdn.net/Expert/topic/1645/1645967.xml

I tried these converters, I personally feel the first http://authors.aspalliance.com/aldotnet/examples/translate.aspx? These are the best of them.

In my experiment, I changed a paging component from the C # code to the VB.net code. The paging component can be viewed as follows:
Http://www.microsoft.com/china/msdn/archives/library/dnaspp/html/PagerControls.asp

C # After the code is converted to VB.net code, I can use it with a slight modification. I made the following changes:

1. in VB.net, classes and enumerations are not public by default. problems may occur during conversion.

2. The event-triggered code is different. For example, the following code:
C # Write as follows:
Protected virtual void onclick (eventargs E)
{
If (Click! = NULL)
{
Click (this, e );
}
}
VB.net is written as follows:
Protected overridable sub onclick (E as eventargs)
Raiseevent click (Me, E)
End sub
3. After conversion, the property information will be misplaced. If there is a comment, it will be put before the comment incorrectly.

If you need to convert the C # code to the VB code, we strongly recommend that you use this tool. The general code can be run after conversion, and the complex code can be modified slightly. It is strongly recommended.

 

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.