Creating methods with infinite parameters?

后端 未结 8 1697
再見小時候
再見小時候 2021-01-31 13:44

In C# you can do this:

foo = string.Format(\"{0} {1} {2} {3} ...\", \"aa\", \"bb\", \"cc\" ...);

This method Format() accepts in

8条回答
  •  灰色年华
    2021-01-31 14:36

    function void MyFunction(string format, params object[] parameters) {
    
    }
    

    Instad of object[] you can use any type your like. The params argument always has to be the last in the line.

提交回复
热议问题