Microsoft Technologies based on the .NET software framework. Miscellaneous topics that do not fit into specific categories.
Hi @ahmet sahgoz , Welcome to Microsoft Q&A,
Try Use TryGetBuffer().
If the MemoryStream is not resizable (MemoryStream.CanWrite == false), TryGetBuffer() provides a view without copying (if you control the MemoryStream and it does not expose unnecessary data, you can use MemoryStream.GetBuffer()):
if (memoryStream.TryGetBuffer(out ArraySegment<byte> segment))
{
byte[] buffer = segment.Array;
int offset = segment.Offset;
int length = segment.Count;
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.