diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/EscapingUtilities.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/EscapingUtilities.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/EscapingUtilities.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/EscapingUtilities.cs index 94a180f36d..803ff6df8a 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/EscapingUtilities.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/EscapingUtilities.cs @@ -5,7 +5,8 @@ using System; using System.Collections.Generic;
using System.Globalization;
using System.Text;
-
+using MonoDevelop.Core; + namespace Microsoft.Build.Shared
{
/// <summary>
@@ -70,7 +71,7 @@ namespace Microsoft.Build.Shared }
// This is where we're going to build up the final string to return to the caller.
- StringBuilder unescapedString = new StringBuilder (escapedString.Length);
+ StringBuilder unescapedString = StringBuilderCache.Allocate ();
int currentPosition = 0;
@@ -112,7 +113,7 @@ namespace Microsoft.Build.Shared // characters into the destination.
unescapedString.Append(escapedString, currentPosition, escapedString.Length - currentPosition);
- return unescapedString.ToString ();
+ return StringBuilderCache.ReturnAndFree (unescapedString);
}
@@ -172,16 +173,16 @@ namespace Microsoft.Build.Shared }
// This is where we're going to build up the final string to return to the caller.
- StringBuilder escapedStringBuilder = new StringBuilder (unescapedString.Length * 2);
+ StringBuilder escapedStringBuilder = StringBuilderCache.Allocate ();
AppendEscapedString(escapedStringBuilder, unescapedString);
if (!cache)
{
- return escapedStringBuilder.ToString ();
+ return StringBuilderCache.ReturnAndFree (escapedStringBuilder);
}
- string escapedString = escapedStringBuilder.ToString ();
+ string escapedString = StringBuilderCache.ReturnAndFree (escapedStringBuilder);
lock (s_unescapedToEscapedStrings)
{
|