Skip to content

Document when MemoryStream.TryGetBuffer returns false #3634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions xml/System.IO/MemoryStream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2016,11 +2016,29 @@ The pending operation does not support writing.</exception>
<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" />
</Parameters>
<Docs>
<param name="buffer">The byte array segment from which this stream was created.</param>
<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>
<summary>Returns the array of unsigned bytes from which this stream was created. The return value indicates whether the conversion succeeded.</summary>
<returns>
<see langword="true" /> if the conversion was successful; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
<see langword="true" /> if the buffer is exposable; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown">
<![CDATA[

## Remarks

This method returns `true` when the the underlying buffer is marked as exposable, which happens when the current `MemoryStream` instance is created with:

- <xref:System.IO.MemoryStream.%23ctor>.
- <xref:System.IO.MemoryStream.%23ctor%28System.Int32%29).
- <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`.

The underlying buffer will not be exposed if the current `MemoryStream` instance is created with:

- <xref:System.IO.MemoryStream.%23ctor%28System.Byte%5B%5D,System.Boolean%29).
- <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`.

]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Write">
Expand Down