Avoid using member names that are identical to a property's Set method. Although the compiler allows members and Set methods to be named identically, doing this creates code that is difficult to understand and maintain. Additionally, identically named members and Set methods may indicate deeper logic problems in the application.
For instance, the following code contains a subroutine named "SetNewCustomerID" and a property named "NewPropertyID":
' VB
Sub SetNewCustomerID()
' 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 SetNewCustomerID()
{
// some code here
}
public string NewCustomerID
{
get
{
// some code here
}
set
{
// some code here
}
}
' VB
Sub CreateNewCustomerID()
' 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 SetNewCustomerID()
{
// some code here
}
public string NewCustomerID
{
get
{
// some code here
}
set
{
// some code here
}
}