diff options
author | Alexander Radchenko <radchenkosasha@gmail.com> | 2016-11-14 22:58:58 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-14 22:58:58 +0700 |
commit | 976519d243e28ced430efddbfc932390f3b37528 (patch) | |
tree | 2a78fdfcb6bd4f3036af708ed14c66177a0a01d9 /src | |
parent | 32fa4911074bf95a30f7fa1828701fb920af91c6 (diff) | |
download | coreclr-976519d243e28ced430efddbfc932390f3b37528.tar.gz coreclr-976519d243e28ced430efddbfc932390f3b37528.tar.bz2 coreclr-976519d243e28ced430efddbfc932390f3b37528.zip |
Fixed string Join method
Fixed string Join(string separator, params object[] values) method.
Calling string.Join(",", null, 1, 2, 3); return empty string but should ",1,2,3".
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/src/System/String.Manipulation.cs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mscorlib/src/System/String.Manipulation.cs b/src/mscorlib/src/System/String.Manipulation.cs index 563cd8193b..0b3f53301b 100644 --- a/src/mscorlib/src/System/String.Manipulation.cs +++ b/src/mscorlib/src/System/String.Manipulation.cs @@ -558,15 +558,13 @@ namespace System throw new ArgumentNullException(nameof(values)); Contract.EndContractBlock(); - if (values.Length == 0 || values[0] == null) + if (values.Length == 0) return string.Empty; - string firstString = values[0].ToString(); + string firstString = values[0]?.ToString(); if (values.Length == 1) - { return firstString ?? string.Empty; - } StringBuilder result = StringBuilderCache.Acquire(); result.Append(firstString); |