The overload of AppendFormat
that you are currently using (or that the compiler decided to use) has the following signature:
public StringBuilder AppendFormat(string format, object arg0)
It is expecting a single argument and therefore a format
that contains two arguments ("{0}, {1}"
) is invalid.
Your intention is to pass the array as multiple arguments, the overload that you need to use is the following:
public StringBuilder AppendFormat(string format, params object[] args)
Note that the second argument is an object[]
, not int[]
. To make your code use this overload, you need to convert the int
array into an object
array like this:
builder.AppendFormat("{0}, {1}", values.Cast<object>().ToArray());