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 |
// Method public int ID { get { return ID; } set { ID = value; } } // Method public int ID { get; set; } |
?
VB. NET object: The syntax format is
?
123456789 |
Private stuCardID As String 'defines static attributes Public Property CardID() As String Get Return stuCardID: obtains the attribute value. End Get Set(value As String) StuCardID = value ': sets the attribute value. End Set End 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 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.