/// <summary>
/// 什麼鳥?
/// </summary>
private string GetCode(decimal A, decimal B)
{
string code = "B";
if (A > B)
{
code = "Y";
}
else if (A < B)
{
code = "O";
}
return code;
}
/// <summary>
/// 直接返回鳥
/// 兼顧可讀性和可重構性
/// </summary>
private string GetCode_R1(decimal A, decimal B)
{
if (A > B)
return "Y";
if (A < B)
return "O";
return "B";
}
/// <summary>
/// 可讀性差的鳥
/// 韌體工程師的最愛
/// </summary>
private string GetCode_R2(decimal A, decimal B)
{
return A > B ? "Y" : (A < B ? "O" : "B");
}
留言列表