标签:world ide datetime coding arc round 条件判断 静态变量 tor
public class HelloWorld { public void SayHello(string name) { } }
Pascal规则是指名称中单词的首字母大写 ,如EmployeeSalary、 ConfimationDialog、PlainTextEncoding。
public class Product { private string productId; private string productName; public void AddProduct(string productId,string productName) { } }
Camel规则类似于Pascal规则 ,但名称中第一个单词的首字母不大写 ,如employeeSalary、 confimationDialog、plainTextEncoding。
不要给成员变量加任何前缀(如、m、s_等等)。如果想要区分局部变量和成员变量,可以使用用this登关键字。
// Correct public static const string ShippingType = "DropShip";
// Avoid public static const string SHIPPINGTYPE = "DropShip";
public interface IConvertible { byte ToByte(); }
public class TableAttribute:Attribute { }
public class NullEmptyException:Exception { }
public class Employee { } public class BusinessLocation { } public class DocumentCollection { }
public class File { public void CreateFile(string filePath) { } public void GetPath(string path) {
} }
、
或者用should
做前缀。如,isFinished, canWork等。
public Sample() { // TODO: 在此处添加构造函数逻辑 }
// 不友好的写法 private bool isFinished = true; if(isFinished == true) { // ... } // 正确的写法 private bool isFinished = true; if(isFinished) { // ... }
// Correct public class Account { public static string BankName; public static decimal Reserves; public string Number {get; set;} public DateTime DateOpened {get; set;} public DateTime DateClosed {get; set;} public decimal Balance {get; set;} // Constructor public Account() { // ... } }
标签:world ide datetime coding arc round 条件判断 静态变量 tor
原文地址:https://www.cnblogs.com/chonglu/p/12458543.html