Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corlib: Implement String.Concat(O,O,O,O,__arglist). #58

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading