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
// Method public int ID {get {return ID;} set {ID = value ;}}// method public int ID {get; set ;}
VB. NET object: The syntax format is
Private stuCardID As String 'defines the static Property Public Property CardID () As String Get Return stucardid'. function: gets the attribute value End Get Set (value As String) stuCardID = value'. function: set the attribute value End Set End Property
Ii. Methods (functions)
C # method: the syntax format is
// Syntax: Method Name (parameter [entity instance]) public void Modify (Login. Model. UserInfo user) {// method body}
VB. NET method: the syntax format is
'Syntax: Access restricted character Function keyword Function name (parameter [ByVal object instance]) As return value type Public Function UserLogon (ByVal User As Entity. logonEntity) As Entity. logonEntity Dim user1 As New Entity. logonEntity 'method body Return user1 End 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.