Vb. Comparison of NET and C #

Source: Internet
Author: User
Tags comparison constructor static class

Global Layer

VB Support module, is a special type of all members are static

C # supports static class, similar to VB's module;

The Imports statement of VB can import static members of a class, while C # 's using statement does not have this function

Imports System.Math

VB can select whether the variable must be declared, and whether the type must be specified (by option statement)

C # is the default VB most stringent state

C # can use extern alias to specify an alias for an assembly and use the alias-qualified operator:: To resolve two assemblies of class name collisions

VB does not have this function, but can use the Global keyword to obtain namespace-level name conflict resolution capabilities

C # can specify friend assemblies, VB does not support

Member Layer

VB can directly rewrite the Object.Finalize method, and C # must use the syntax of the destructor

C # can specify target of attribute to place attributes clearly, while VB is determined by the position of the angle bracket, sometimes it can't write some kind of C # workable syntax

VB can overload these C # unsupported operators: ampersand, ^, like, \

C # can overload the operators that are not supported by these VB: + +,--,!

VB constructor of the Neutron class, first call the constructor of the parent class before initializing the fields of the subclass

C # The constructor of a neutron class, which initializes the fields of the subclass before invoking the constructor of the parent class

The implemnts statement of VB can change the access level by renaming the method of implementing the interface.

C # does not support but there is an explicit implementation syntax that can help

vb function overload, subclass and parent class methods are treated as siblings

C # 's function overload, the subclass takes precedence over the parent class

VB main function automatically add, you can change

Continue member Layer

Custom event in C # can modify rules for add and remove

VB Custom event In addition to C #, also supports the use of overloaded RaiseEvent statements

VB event can directly write the event parameters, automatic generation of Delege type

The event in C # must specify the delegate type

VB supports withevents/handles static event binding syntax, and also supports AddHandler dynamic binding methods

C # events only support dynamic binding with + =

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.