Creating methods with infinite parameters?

后端 未结 8 1775
再見小時候
再見小時候 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:37

    A few notes.

    Params needs to be marked on an array type, like string[] or object[].

    The parameter marked w/ params has to be the last argument of your method. Foo(string input1, object[] items) for example.

提交回复
热议问题