What are the most common naming conventions in C# for classes, namespaces and methods? Is it common to have getter/setter style methods as in Java?
There are a few common patterns out there. One I frequently see and use in my own projects is:
namespace Company.Concept.SubConcept
{
public class MyClass
{
private MyType someData;
public MyType SomeData
{
get { return someData; }
set { someData = value; }
}
public void MyMethod()
{
}
}
}
MSDN provides Design Guidelines that spell this out in detail.
No it is not common to use getter /setter style names in C#. Properties should be used for almost all places you would use a getter / setter in Java.
IMHO, the defacto standard for naming conventions comes from the Framework Design Guidelines. It's enforced by several tools (FxCop) and is the dominant style of many libraries including the BCL.
I think that most projects are using the IDesign CSharp Coding Standard
Check out Lance's page
http://weblogs.asp.net/lhunt/pages/CSharp-Coding-Standards-document.aspx
and
Naming guidelines
Guidelines for Names (from Design Guidelines for Developing Class Libraries, in which you will also find sections about properties and choosing between properties and methods. In that last article, you will find the following:
Do use a property, rather than a method, if the value of the property is stored in the process memory and the property would just provide access to the value.