private static string Js_concat(string target, object[] args)
{
int N = args.Length;
if (N == 0)
{
return target;
}
else
{
if (N == 1)
{
string arg = ScriptRuntime.ToString(args[0]);
return System.String.Concat(target, arg);
}
}
// Find total capacity for the final string to avoid unnecessary
// re-allocations in StringBuffer
int size = target.Length;
string[] argsAsStrings = new string[N];
for (int i = 0; i != N; ++i)
{
string s = ScriptRuntime.ToString(args[i]);
argsAsStrings[i] = s;
size += s.Length;
}
StringBuilder result = new StringBuilder(size);
result.Append(target);
for (int i_1 = 0; i_1 != N; ++i_1)
{
result.Append(argsAsStrings[i_1]);
}
return result.ToString();
}