String.Format 嵌入框架中的位置
有幾個地方你可以間接使用 String.Format
:祕訣是用簽名 string format, params object[] args
尋找過載,例如:
Console.WriteLine(String.Format("{0} - {1}", name, value));
可以用更短的版本替換:
Console.WriteLine("{0} - {1}", name, value);
還有其他方法也使用 String.Format
e.g。:
Debug.WriteLine(); // and Print()
StringBuilder.AppendFormat();