Remove StringBuilderCache from Version.ToString (#48511)
authorStephen Toub <stoub@microsoft.com>
Fri, 19 Feb 2021 18:38:31 +0000 (13:38 -0500)
committerGitHub <noreply@github.com>
Fri, 19 Feb 2021 18:38:31 +0000 (13:38 -0500)
commit1d2b40b9906d96895cdbac009ded32158913add1
tree48218341e8fb57b813e38b573cbd522e0d8a3c65
parentf1573e7498bbb1d8443c78fd9c1581f09872d851
Remove StringBuilderCache from Version.ToString (#48511)

Rather than using a StringBuilder in both ToString and TryFormat, we can just write ToString in terms of TryFormat and use stack space for the small string being generated.  As part of this, I removed the extra code optimizing ToString(0) and ToString(1), as I can't find any real code anywhere that does that and it's not worth the extra lines.
src/libraries/System.Private.CoreLib/src/System/Version.cs