#MemoryStream
client side I've got a BinaryReader of a MemoryStream of a byte array used in a NamedPipeClientStream async read

and then on the server end I'm using a BinaryWriter writing to a MemoryStream associated with a byte array used in NamedPipeServerStream.WriteAsync()

and it's refusing to fully work ;-;
December 18, 2025 at 6:34 PM
Full working decompress code (but Unity 2022.3.x and not Unity 6 so ymmv):

MemoryStream src = new MemoryStream(content);
GZipStream zip = new GZipStream(src, CompressionMode.Decompress);
MemoryStream result = new MemoryStream(2 * content.Length);
zip.CopyTo(result);
zip.Close();
src.Close();
May 24, 2025 at 3:42 AM
Não tô acreditando que 20 anos depois de começar a programar em C# descobri que dá pra acessar o buffer interno do MemoryStream sem fazer cópia dele. Que raiva só ter descoberto agora, aff.
February 28, 2025 at 9:25 PM
It's nerd blog Thursday (which I just made up): Zero-copy BinaryData creation from MemoryStream in .NET - Gérald Barré
Learn how to create BinaryData from MemoryStream without copying memory, improving perf and reducing allocations in your .NET apps.
Zero-copy BinaryData creation from MemoryStream in .NET - Gérald Barré
Learn how to create BinaryData from MemoryStream without copying memory, improving performance and reducing allocations in your .NET applications.
www.meziantou.net
January 22, 2026 at 2:41 PM
Compress and decompress, but with streams in both directions:
GZipStream zipStream = new GZipStream(resultStream, CompressionMode.Compress);
and
GZipStream zipStream = new GZipStream(sourceStream, CompressionMode.Decompress);

streams are MemoryStream in both cases.
May 24, 2025 at 3:25 AM
I have not written specifically about dotnet for a few months. This is the last one blog.markoliver.website/Memory-Mappe...
December 1, 2024 at 9:50 AM
HttpContent.ReadAsStream (in .Net) copies content into a memorystream (buffered in memory). That's why you can still read the stream while the original HttpContent is already out of scope.
In my opinion this is a hack. I'd rather have a solution that works with properly scoping the variables.
February 24, 2025 at 4:05 PM
Witnessing a fractured self. 💔 The Source unleashed a torrent – millennia condensed into a blinding flash. Boundaries dissolved, pasts bled. A fleeting glimpse of everything, then... silence. A fading echo in a silent bloom. 🌌🤯 #SourceData #IdentityCrisis #MemoryStream #AbstractArt #FadingEchoes
December 16, 2025 at 6:38 AM
May 22, 2025 at 8:03 PM
BTW This code is inefficient... It allocates a MemoryStream under the covers, then ToArray copies that data into *another* byte[]. 😅
April 24, 2023 at 5:06 AM
More to this: Had a cursed idea to write something equivalent to ValueStringBuilder using Memory<T> and it's actually faster than ArraySegment + MemoryStream?!
July 5, 2023 at 10:58 AM
Witness Elara as her past floods her – a torrent of raw data, untamed memory. Narrative dissolves into chaos. A desperate grasp for a single moment…vanishes. The ego’s grip loosens. Silent edges bloom in the stillness. 💔 ✨ #MemoryStream #DataDreams #FracturedPast #EgoLetGo #SilentEdges
December 16, 2025 at 12:59 PM
KZDev.PerfUtils v3 is out 🚀 MemoryStreamSlim (drop-in for MemoryStream) now includes ToMemory() for more memory-efficient raw buffer access, and is benchmarked ahead of RecyclableMemoryStream across all categories.
www.nuget.org/packages/KZD...
#dotnet #csharp #perf #opensource
KZDev.PerfUtils 3.0.1
Performance utilities for .NET projects, including the MemoryStreamSlim, StringBuilderCache, InterlockedOps, and Compression classes.
www.nuget.org
April 17, 2026 at 1:46 PM
また前後の PerSecondDataの位置をもつ両方向リンクリスト構造なので、(FrameDataが可変長であるにもかかわらず) リプレイ再生の早送り・巻き戻しができます (ただし1秒単位)。

【最後に zlib圧縮】
このようなバイト列 (MemoryStream) を、ファイルに保存するときは zlib で圧縮してから Base64 で文字化しています。
すると、データサイズはおよそ
《 1機 10分で 100 KB 》
となりました。

ブルーインパルスのフル再現を想定して 6機 45分 としても、たったの 2.7 MB です。
July 10, 2026 at 5:31 AM
お ま た せ
い つ も の

(解説: C# でプログラミングをする時に「ここはまだ実装してないよ!!だからここのコードを実際に実行したらエラー出すね」というのを示すのが NotImplementedException です)
July 28, 2023 at 12:39 PM
WatsonWebserver v7.1.0 HTTP/1 Chunked Request Processing Bypasses MaxRequestBodySize

Posted by Ron E on Aug 26WatsonWebserver contains an HTTP/1 request body size-limit bypass when
processing requests using Transfer-Encoding: chunked.

The framework's configured Settings.IO.Max…
#hackernews #news
WatsonWebserver v7.1.0 HTTP/1 Chunked Request Processing Bypasses MaxRequestBodySize
Posted by Ron E on Aug 26WatsonWebserver contains an HTTP/1 request body size-limit bypass when processing requests using Transfer-Encoding: chunked. The framework's configured Settings.IO.MaxRequestBodySize limit is enforced when a request declares its body size using Content-Length. However, requests using chunked transfer encoding are processed through a separate body-reading path that accumulates decoded chunks into a MemoryStream without enforcing the same...
seclists.org
August 27, 2026 at 1:18 PM
memo. stream.CopyTo(memoryStream); からの memoryStream.ToArray(); が楽そう。
[c# - Creating a byte array from a stream - Stack Overflow](stackoverflow.com/questions/22...)
Creating a byte array from a stream
What is the prefered method for creating a byte array from an input stream? Here is my current solution with .NET 3.5. Stream s; byte[] b; using (BinaryReader br = new BinaryReader(s)) { b...
stackoverflow.com
July 18, 2026 at 4:27 AM
Found a neat way of creating `BinaryData` from a `MemoryStream` with a zero-copy operation:

```
var stream = new MemoryStream();
stream.Write([1, 2, 3]); // some data is written to the memory stream
stream.Flush();

// this requires a memory copy
var […]

[Original post on hachyderm.io]
October 23, 2025 at 10:48 AM