private field and public property naming conventions
From: Adam Tatusko, MCSD, MCAD, MCDBA, MCSE, MCSA (adamtatusko_at_hotmail.com)
Date: 01/24/05
- Next message: Cowboy (Gregory A. Beamer) - MVP: "RE: Need help"
- Previous message: DCraig: "Re: Problem with dependency conflicts"
- Next in thread: Cowboy (Gregory A. Beamer) - MVP: "RE: private field and public property naming conventions"
- Reply: Cowboy (Gregory A. Beamer) - MVP: "RE: private field and public property naming conventions"
- Messages sorted by: [ date ] [ thread ]
Date: 24 Jan 2005 12:49:45 -0800
Has anyone found any naming convention guidelines for private fields
and public properties in Visual Basic .NET and C#.
Below is what I currently do in each of the languages. Any comments?
I would like to use the same convention in C# as in Visual Basic .NET
with camelCasing for private fields and PascalCasing for public
properties, but since Visual Basic .NET is case insensitive, I have to
use a different name for the public property and its associated private
field (e.g. add "m_" for private field). Any suggestions or
documentation from Microsoft. The Design Guidelines for Class Library
Developers at:
does not provide much advice on this issue. Also is there any
guidelines on when this and Me should be used to fully qualify a public
or private member?
// C#
public class Test
{
private string myVariable;
public string MyVariable
{
get
{
return myVariable;
}
set
{
myVariable = value;
}
}
}
' Visual Basic .NET
Public Class Test
Private m_myVariable As String
Public Property MyVariable() As String
Get
Return m_myVariable
End Get
Set(ByVal value As String)
m_myVariable = value
End Set
End Property
End Class
- Next message: Cowboy (Gregory A. Beamer) - MVP: "RE: Need help"
- Previous message: DCraig: "Re: Problem with dependency conflicts"
- Next in thread: Cowboy (Gregory A. Beamer) - MVP: "RE: private field and public property naming conventions"
- Reply: Cowboy (Gregory A. Beamer) - MVP: "RE: private field and public property naming conventions"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|