Difference between VB. NET and C # syntax,

Source: Internet
Author: User

Difference between VB. NET and C # syntax,

After learning VB. NET, we found that the syntax of VB. NET and C # is mainly different in two parts. If the two parts are completed, they can be easily solved. The comparison is summarized as follows:

I. Entity

(Compared with VB, in C # and VB. NET, the use of entities is innovative and presented as the first comparison)

C # entity: the syntax format is

?
1234567891011 // Methodpublic int ID {     get { return ID; }    set { ID = value; } }// Methodpublic int ID { get; set; }

 

?
1  

 

 

 

VB. NET object: The syntax format is

?
123456789 Private stuCardID As String 'defines static attributesPublic Property CardID() As String    Get        Return stuCardID: obtains the attribute value.    End Get    Set(value As String)        StuCardID = value ': sets the attribute value.    End SetEnd Property

 

Ii. Methods (functions)

C # method: the syntax format is

?
12345 // Syntax: Method Name of the type returned by the access restriction character (parameter [entity instance])        public void Modify(Login.Model.UserInfo user)        {            // Method body        }

VB. NET method: the syntax format is

 

 

?
123456 'Syntax: Access restricted character function keyword function name (parameter [ByVal object instance]) As return value typePublic Function UserLogon(ByVal User As Entity.LogonEntity) As Entity.LogonEntity    Dim user1 As New Entity.LogonEntity          'Method body    Return user1End Function


Everyone is touched by the difficulties and hardships of new knowledge and new environment. In this simple summary, the difference between the syntax and the small packet will be forgotten after a long time. Enable it whenever necessary to reduce the burden of memory.

Related Article

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.