Skip to content

Commit b98e9fc

Browse files
authored
Document when MemoryStream.TryGetBuffer returns false (#3634)
* Document when MemoryStream.TryGetBuffer returns false * fix build warnings in xrefs
1 parent 81c5d80 commit b98e9fc

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

xml/System.IO/MemoryStream.xml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,11 +2016,29 @@ The pending operation does not support writing.</exception>
20162016
<Parameter Name="buffer" Type="System.ArraySegment&lt;System.Byte&gt;" RefType="out" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
20172017
</Parameters>
20182018
<Docs>
2019-
<param name="buffer">The byte array segment from which this stream was created.</param>
2019+
<param name="buffer">When this method returns <see langword="true" />, the byte array segment from which this stream was created; when this method returns <see langword="false" />, this parameter is set to <see langword="default" />.</param>
20202020
<summary>Returns the array of unsigned bytes from which this stream was created. The return value indicates whether the conversion succeeded.</summary>
20212021
<returns>
2022-
<see langword="true" /> if the conversion was successful; otherwise, <see langword="false" />.</returns>
2023-
<remarks>To be added.</remarks>
2022+
<see langword="true" /> if the buffer is exposable; otherwise, <see langword="false" />.</returns>
2023+
<remarks>
2024+
<format type="text/markdown">
2025+
<![CDATA[
2026+
2027+
## Remarks
2028+
2029+
This method returns `true` when the the underlying buffer is marked as exposable, which happens when the current `MemoryStream` instance is created with:
2030+
2031+
- <xref:System.IO.MemoryStream.%23ctor>.
2032+
- <xref:System.IO.MemoryStream.%23ctor%28System.Int32%29).
2033+
- <xref:System.IO.MemoryStream.%23ctor%28System.Byte%5B%5D,System.Int32,System.Int32,System.Boolean,System.Boolean%29) with the parameter `publiclyVisible` set to `true`.
2034+
2035+
The underlying buffer will not be exposed if the current `MemoryStream` instance is created with:
2036+
2037+
- <xref:System.IO.MemoryStream.%23ctor%28System.Byte%5B%5D,System.Boolean%29).
2038+
- <xref:System.IO.MemoryStream.%23ctor%28System.Byte%5B%5D,System.Int32,System.Int32,System.Boolean,System.Boolean%29) with the parameter `publiclyVisible` set to `false`.
2039+
2040+
]]></format>
2041+
</remarks>
20242042
</Docs>
20252043
</Member>
20262044
<Member MemberName="Write">

0 commit comments

Comments
 (0)