Avoid using member names that are identical to a property's Get method. Although the compiler allows members and Get methods to be named identically, doing this creates code that is difficult to understand and maintain. Additionally, identically named members and Get methods may indicate deeper logic problems in the application.
For instance, the following code contains a subroutine named "GetNewCustomerID" and a property named "NewPropertyID":
' VB
Sub GetNewCustomerID()
' some code here...
End Sub
Public Property NewCustomerID() As String
Get
' some code here
End Get
Set(ByVal value As String)
' some code here
End Set
End Property
// C#
static void GetNewCustomerID()
{
// some code here
}
public string NewCustomerID
{
get
{
// some code here
}
set
{
// some code here
}
}
' VB
Sub GenerateNewCustomerID()
' some code here...
End Sub
Public Property NewCustomerID() As String
Get
' some code here
End Get
Set(ByVal value As String)
' some code here
End Set
End Property
// C#
static void GetNewCustomerID()
{
// some code here
}
public string NewCustomerID
{
get
{
// some code here
}
set
{
// some code here
}
}