summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Moseley <danmose@microsoft.com>2018-09-04 15:21:28 -0700
committerJan Kotas <jkotas@microsoft.com>2018-09-05 08:12:13 -0700
commit20ee9b884cdc04826826b95e0952f9c5b5e650dc (patch)
tree633bf68d04ae7197b611529521b555e9b4547d44
parentaee79af9a233c397bc3140af2e0ef2d83cf436bf (diff)
downloadcoreclr-20ee9b884cdc04826826b95e0952f9c5b5e650dc.tar.gz
coreclr-20ee9b884cdc04826826b95e0952f9c5b5e650dc.tar.bz2
coreclr-20ee9b884cdc04826826b95e0952f9c5b5e650dc.zip
Fix ServiceController name population perf (dotnet/corefx#32072)
* Fix ServiceController name population perf * Split tests * Remove dead field * Remove new use of DangerousGetHandle * SafeHandle all the things! * VSB #1 * VSB #2 * Fix GLE * Initialize machineName in ctor * Test for empty name ex * Null names * Inadvertent edit * Unix build * Move interop into class * Reverse SafeHandle for HAllocGlobal * Fix tests * Disable test for NETFX * CR feedback * Pattern matching on VSB * Direct call * typo Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs b/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
index 21cc3dc010..74b5dacf97 100644
--- a/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
@@ -50,9 +50,20 @@ namespace System.Text
/// <summary>
/// Get a pinnable reference to the builder.
+ /// Does not ensure there is a null char after <see cref="Length"/>
+ /// This overload is pattern matched in the C# 7.3+ compiler so you can omit
+ /// the explicit method call, and write eg "fixed (char* c = builder)"
+ /// </summary>
+ public ref char GetPinnableReference()
+ {
+ return ref MemoryMarshal.GetReference(_chars);
+ }
+
+ /// <summary>
+ /// Get a pinnable reference to the builder.
/// </summary>
/// <param name="terminate">Ensures that the builder has a null char after <see cref="Length"/></param>
- public ref char GetPinnableReference(bool terminate = false)
+ public ref char GetPinnableReference(bool terminate)
{
if (terminate)
{