Variable Argument Lists in C++/CLI

How do I create a function which accepts a variable argument list in C++/CLI? I am looking to create a function which forwards most of it's arguments to String::Format.


Declare the last argument as a managed array prefixed with an ellipsis.

Here is a variable argument function that just passes all of its arguments to String::Format

String ^FormatAString(String ^format, ...array<Object^> ^args)
  return String::Format(format, args);

And here is how to call it:

Console::WriteLine(FormatAString(L"{0} {1} {2}.", 40.5, "hello", DateTime::Now));

Need Your Help

C# : Blocking a function call until condition met

c# winforms blocking

I am developing a C# Winforms application, part of the application will be uploading files to a webserver using AsyncUpload (using it,due to the need to use a porgress callback) , In the C# program...

.NET Format a string with fixed spaces

.net string

Does the .NET String.Format method allow placement of a string at a fixed position within a fixed length string.