Avoid having identical variable and class names. Although the compiler allows classes and variables to be named identically, doing this creates code that is difficult to understand and maintain. For example, the following code contains a variable with the same name as the class:
' VB
Public Class Customer
Sub CreateCustomerID()
Dim Customer As String
Customer = "John Doe"
End Sub
End Class
// C#
class Customer
{
public static void CreateCustomerID()
{
string Customer;
Customer = "John Doe";
}
}
Public Class Class1
Sub test()
Dim CustomerID As Integer
End Sub
End Class
Public Module MainMod
Dim CustomerID As Integer
End Module
' VB
Public Class CustomerInformation
Dim CustomerName As String
Sub CreateCustomerID()
CustomerName = "John Doe"
End Sub
End Class
// C#
class CustomerInformation
{
public static void CreateCustomerID()
{
string CustomerName;
Customer = "John Doe";
}
}