Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 C++/CLI 中创建一个接受变量参数列表的函数?我希望创建一个函数,将它的大部分参数转发到String::Format.
String::Format
将最后一个参数声明为以省略号为前缀的托管数组。
这是一个变量参数函数,它只是将其所有参数传递给 String::Format
String ^FormatAString(String ^format, ...array<Object^> ^args) { return String::Format(format, args); }
这是如何称呼它的:
Console::WriteLine(FormatAString(L"{0} {1} {2}.", 40.5, "hello", DateTime::Now));