C#中最常见的命名约定是什么?
问题描述:
在C#中,类,名称空间和方法最常用的命名约定是什么?在Java中使用getter/setter样式方法是否很常见?
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()
{
}
}
}