給 MyMethod
新增一個型別為 string
的 fname
引數。
static void MyMethod(@(6) @(5)) { Console.WriteLine(fname + " Refsnes"); } static void Main(string[] args) { MyMethod("利亞姆"); MyMethod("詹妮"); MyMethod("安雅"); }
static void MyMethod(string fname) { Console.WriteLine(fname + " Refsnes"); } static void Main(string[] args) { MyMethod("利亞姆"); MyMethod("詹妮"); MyMethod("安雅"); }