Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaizur Rahman <shrah@microsoft.com>2017-06-24 03:16:19 +0300
committerFaizur Rahman <shrah@microsoft.com>2017-06-24 03:16:19 +0300
commitaece857a9d95a89e5c433f7a6956ee96db7e947c (patch)
treeeabab562ad6448555a0e7205a8df9c2462bfd5b6 /src/System.Private.Interop
parentda0a0051b9e78e1b0026e7943a249bdc542fc415 (diff)
Add Marshal.PtrToStringUni internal implementation in S.P.CoreLib
This change adds and internal Marshal.PtrToStringUni in S.P.CoreLib to unblock the benchmark Sergiy has been working on. [tfs-changeset: 1662877]
Diffstat (limited to 'src/System.Private.Interop')
-rw-r--r--src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs
index c655d8450..6f0cdfa09 100644
--- a/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs
@@ -99,28 +99,12 @@ namespace System.Runtime.InteropServices
public static unsafe String PtrToStringUni(IntPtr ptr, int len)
{
- if (ptr == IntPtr.Zero)
- throw new ArgumentNullException(nameof(ptr));
- if (len < 0)
- throw new ArgumentException(nameof(len));
-
- return new String((char*)ptr, 0, len);
+ return PInvokeMarshal.PtrToStringUni(ptr, len);
}
public static unsafe String PtrToStringUni(IntPtr ptr)
{
- if (IntPtr.Zero == ptr)
- {
- return null;
- }
- else if (IsWin32Atom(ptr))
- {
- return null;
- }
- else
- {
- return new String((char*)ptr);
- }
+ return PInvokeMarshal.PtrToStringUni(ptr);
}
public static String PtrToStringAuto(IntPtr ptr, int len)