VB and .Net Naming Guidelines
-
Hi, The .Net naming guidelines cannot be fully applied to Visual Basic. You can almost do it because, despite VB's case insensitivity, variable/method/property names and type names are in different namespaces and so do not clash. I don't think this was the case in VB6. For example, in VB .Net you can do: Dim customer As Customer and the compiler understands that customer is different from Customer. But for properties you run into trouble Private name Public Property Name() As String Get Return name End Get End Property name and Name clash so you end up having to do Private m_name or something. If the compiler could distinguish between variables and methods then the .Net conventions could be applied consistently for both VB and C#. With C#, I've been trying to follow the new guidelines but I'm still using Hungarian prefixes for controls. Microsoft don't say what to do for controls but I guess we should use full suffixes, i.e., customerText customerLabel customerCombo etc. Comments anyone? Kevin
-
Hi, The .Net naming guidelines cannot be fully applied to Visual Basic. You can almost do it because, despite VB's case insensitivity, variable/method/property names and type names are in different namespaces and so do not clash. I don't think this was the case in VB6. For example, in VB .Net you can do: Dim customer As Customer and the compiler understands that customer is different from Customer. But for properties you run into trouble Private name Public Property Name() As String Get Return name End Get End Property name and Name clash so you end up having to do Private m_name or something. If the compiler could distinguish between variables and methods then the .Net conventions could be applied consistently for both VB and C#. With C#, I've been trying to follow the new guidelines but I'm still using Hungarian prefixes for controls. Microsoft don't say what to do for controls but I guess we should use full suffixes, i.e., customerText customerLabel customerCombo etc. Comments anyone? Kevin
Where are these naming guidelines? I use m_iCount or miCount for member variables, iCount for local variables and Count for property names, and I dont have any problems. -- David Wengier TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot." Sonork ID: 100.14177 - Ch00k
-
Where are these naming guidelines? I use m_iCount or miCount for member variables, iCount for local variables and Count for property names, and I dont have any problems. -- David Wengier TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot." Sonork ID: 100.14177 - Ch00k
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp Hungarian notation is not recommended in the the new guidelines. However, you cannot apply these guidleines consistently to VB .NET. Though some are now suggesting that you can use what you like for private fields and locals. So for the Property problem in VB you can use m_iCount or m_count, etc. Kevin