संपादित करें

इसके माध्यम से साझा किया गया


MemoryStream.TryGetBuffer(ArraySegment<Byte>) Method

Definition

Returns the array of unsigned bytes from which this stream was created. The return value indicates whether the conversion succeeded.

public:
 virtual bool TryGetBuffer([Runtime::InteropServices::Out] ArraySegment<System::Byte> % buffer);
public virtual bool TryGetBuffer (out ArraySegment<byte> buffer);
abstract member TryGetBuffer : ArraySegment -> bool
override this.TryGetBuffer : ArraySegment -> bool
Public Overridable Function TryGetBuffer (ByRef buffer As ArraySegment(Of Byte)) As Boolean

Parameters

buffer
ArraySegment<Byte>

When this method returns true, the byte array segment from which this stream was created; when this method returns false, this parameter is set to default.

Returns

true if the buffer is exposable; otherwise, false.

Remarks

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

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

Note

This method works when the memory stream is closed.

Applies to