diff options
author | Dan Moseley <danmose@microsoft.com> | 2018-09-05 01:21:28 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-09-05 18:33:44 +0300 |
commit | c4f82672cb943413e4e9b3c68efda7d0dd97d02a (patch) | |
tree | 3a325a5deaa4fd498c8a9428c988868bb966d87d | |
parent | c8a9707235d02e7cfc534bf2042cd4da3911b3b4 (diff) |
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.cs | 13 |
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 21cc3dc01..74b5dacf9 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) { |