By looking at the available overloads of System.String.Format this becomes less mysterious:
public static string Format(string format, object arg0);
public static string Format(string format, params object[] args);
public static string Format(IFormatProvider provider, string format, params object[] args);
public static string Format(string format, object arg0, object arg1);
public static string Format(string format, object arg0, object arg1, object arg2);
By adding the fact that OpenEdge does not support .Net vararg parameters (defined with the params
keyword), it becomes clear. Your first example is using the last listed version with 3 object parameters, your second example does not work because there is no overload with 5 parameters.
But it's not impossible to use vararg parameters from OpenEdge. If we look at autocompletion from PDSOE, we see that all 5 signatures are there and that the params keyword is simply ignored. That means you could use the highlighted version with unlimited parameters, but you need to pass an array of type System.Object to it.
This is an example of how it could be done:
DEF VAR v-list AS System.Collections.ArrayList NO-UNDO.
v-list = new System.Collections.ArrayList().
v-list:Add(106).
v-list:Add(DATETIME(10, 31, 2014, 11, 22, 33)).
v-list:Add(1234.56789).
v-list:Add("moo").
MESSAGE System.String:Format("~{0~} ~{1~} ~{2~} ~{3~}", v-list:ToArray())
VIEW-AS ALERT-BOX.