You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<param name="ptr">The address of the first character of the unmanaged string.</param>
6589
+
<summary>Allocates a managed <see cref="T:System.String" /> and copies all characters up to the first null character from an unmanaged UTF-8 string into it.</summary>
6590
+
<returns>A managed string that holds a copy of the unmanaged string if the value of the <paramref name="ptr" /> parameter is not <see langword="null" />; otherwise, this method returns <see langword="null" />.</returns>
6591
+
<remarks>
6592
+
<format type="text/markdown"><![CDATA[
6593
+
6594
+
## Remarks
6595
+
<xref:System.Runtime.InteropServices.Marshal.PtrToStringUTF8%2A> is useful for custom marshaling or for use when mixing managed and unmanaged code. Because this method creates a copy of the unmanaged string's contents, you must free the original string as appropriate. This method provides the opposite functionality of the <xref:System.Runtime.InteropServices.Marshal.StringToCoTaskMemUTF8%2A?displayProperty=nameWithType> methods.
<param name="ptr">The address of the first character of the unmanaged string.</param>
6638
+
<param name="byteLen">The number of bytes to copy.</param>
6639
+
<summary>Allocates a managed <see cref="T:System.String" /> and copies a specified number of bytes from an unmanaged UTF8 string into it.</summary>
6640
+
<returns>A managed string that holds a copy of the unmanaged string if the value of the <paramref name="ptr" /> parameter is not <see langword="null" />; otherwise, this method returns <see langword="null" />.</returns>
6641
+
<remarks>
6642
+
<format type="text/markdown"><![CDATA[
6643
+
6644
+
## Remarks
6645
+
<xref:System.Runtime.InteropServices.Marshal.PtrToStringUTF8%2A> is useful for custom marshaling or when mixing managed and unmanaged code. Because this method creates a copy of the unmanaged string's contents, you must free the original string as appropriate. This method provides the opposite functionality of the <xref:System.Runtime.InteropServices.Marshal.StringToCoTaskMemUTF8%2A?displayProperty=nameWithType> methods.
<param name="s">A managed string to be copied.</param>
9497
+
<summary>Copies the contents of a managed <see cref="T:System.String" /> to a block of memory allocated from the unmanaged COM task allocator.</summary>
9498
+
<returns>An integer representing a pointer to the block of memory allocated for the string, or 0 if <paramref name="s" /> is <see langword="null" />.</returns>
9499
+
<remarks>
9500
+
<format type="text/markdown"><![CDATA[
9501
+
9502
+
## Remarks
9503
+
<xref:System.Runtime.InteropServices.Marshal.StringToCoTaskMemUTF8%2A> is useful for custom marshaling or for use when mixing managed and unmanaged code. Because this method allocates the unmanaged memory required for a string including a null terminator, always free the memory by calling <xref:System.Runtime.InteropServices.Marshal.FreeCoTaskMem%2A?displayProperty=nameWithType>. This method provides the opposite functionality of <xref:System.Runtime.InteropServices.Marshal.PtrToStringUTF8%2A?displayProperty=nameWithType>. The characters of the string are copied as UTF-8 characters.
9504
+
9505
+
]]></format>
9506
+
</remarks>
9507
+
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="s" /> parameter exceeds the maximum length allowed by the operating system.</exception>
9508
+
<exception cref="T:System.OutOfMemoryException">There is insufficient memory available.</exception>
<param name="s">The address of the unmanaged string to free.</param>
11903
+
<summary>Frees an unmanaged string pointer that was allocated using the <see cref="M:System.Runtime.InteropServices.Marshal.StringToCoTaskMemUTF8(System.String)" /> method.</summary>
11904
+
<remarks>
11905
+
<format type="text/markdown"><![CDATA[
11906
+
11907
+
## Remarks
11908
+
The <xref:System.Runtime.InteropServices.Marshal.ZeroFreeCoTaskMemUTF8%2A> method first zeros out and then frees unmanaged memory that was allocated using the <xref:System.Runtime.InteropServices.Marshal.StringToCoTaskMemUTF8%2A> method.
0 commit comments