Skip to content

Commit

Permalink
corlib: Implement String.Concat(O,O,O,O,__arglist).
Browse files Browse the repository at this point in the history
  • Loading branch information
madewokherd committed Feb 5, 2024
1 parent 2a492b6 commit bc1c760
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion mcs/class/corlib/ReferenceSources/String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,32 @@ internal unsafe int IndexOfUnchecked (string value, int startIndex, int count)
public static String Concat(Object arg0, Object arg1, Object arg2, Object arg3, __arglist)
{
// Added to maintain backward compatibility, see https://github.com/mono/mono/issues/9996
throw new PlatformNotSupportedException();
ArgIterator iterator = new ArgIterator (__arglist);

StringBuilder result = StringBuilderCache.Acquire ();

if (!(arg0 is null))
result.Append (arg0.ToString ());

if (!(arg1 is null))
result.Append (arg1.ToString ());

if (!(arg2 is null))
result.Append (arg2.ToString ());

if (!(arg3 is null))
result.Append (arg3.ToString ());

int count = iterator.GetRemainingCount ();

for (int i=0; i<count; i++) {
TypedReference typedref = iterator.GetNextArg ();
object val = TypedReference.ToObject (typedref);
if (!(val is null))
result.Append (val.ToString ());
}

return StringBuilderCache.GetStringAndRelease (result);
}

internal unsafe int IndexOfUncheckedIgnoreCase (string value, int startIndex, int count)
Expand Down

0 comments on commit bc1c760

Please sign in to comment.