diff options
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r-- | mcs/class/corlib/System/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/corlib/System/String.cs | 26 |
2 files changed, 20 insertions, 10 deletions
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index efa0c182ce9..e55ab3bba9a 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,7 @@ +2004-06-11 Martin Baulig <martin@ximian.com> + + * String.cs (Concat): Implemented the varargs version. + 2004-06-10 Sebastien Pouliot <sebastien@ximian.com> * Decimal.cs: Hacked the Parse method to allow the runtime C code to diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs index 8dd71445b6c..f8b8f2a8992 100644 --- a/mcs/class/corlib/System/String.cs +++ b/mcs/class/corlib/System/String.cs @@ -986,10 +986,8 @@ namespace System return Concat (s1, s2, s3); } - // - // Do *not* remove `internal' from that method - // - internal static String Concat (Object obj1, Object obj2, Object obj3, Object obj4) + public static String Concat (Object obj1, Object obj2, Object obj3, + Object obj4, __arglist) { string s1, s2, s3, s4; @@ -1008,13 +1006,21 @@ namespace System else s3 = obj3.ToString (); - if (obj4 == null) - s4 = String.Empty; - else - s4 = obj4.ToString (); + ArgIterator iter = new ArgIterator (__arglist); + int argCount = iter.GetRemainingCount(); - return Concat (s1, s2, s3, s4); - + StringBuilder sb = new StringBuilder (); + if (obj4 != null) + sb.Append (obj4.ToString ()); + + for (int i = 0; i < argCount; i++) { + TypedReference typedRef = iter.GetNextArg (); + sb.Append (TypedReference.ToObject (typedRef)); + } + + s4 = sb.ToString (); + + return Concat (s1, s2, s3, s4); } public static String Concat (String s1, String s2) |