//不应方法名,与所做的操作不一致
public int Add(int a, int b) { return a * b; }
命名长度要适当:
namespace CleanCSharp.Naming.SuitableLength.Dirty { public class Cal { public int AddTwoNumbersTogetherAndReturnTheResult( int theFirstNumberToAdd, int theSecondNumberToAdd) { return theFirstNumberToAdd + theSecondNumberToAdd; } } }
用这种长度:
namespace CleanCSharp.Naming.SuitableLength.Clean { public class Calculator { public int Add(int a, int b) { return a + b; } } }
//定义一个用来存默认新用户名字的变量 var n = "Jason"; // default name of new user var name = "Jason"; //推荐这种 var defaultNewUserName = "Jason";