implementing-io-pipelines

Solid

Implements high-performance streaming using System.IO.Pipelines in .NET. Use when building network protocols, parsing binary data, or processing large streams efficiently.

Data & Documents 40 stars 6 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
40
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# .NET Streaming (System.IO.Pipelines) A guide for System.IO.Pipelines API for high-performance I/O pipelines. **Quick Reference:** See [QUICKREF.md](QUICKREF.md) for essential patterns at a glance. ## 1. Core Concepts | Concept | Description | |---------|-------------| | `Pipe` | Memory buffer-based read/write pipe | | `PipeReader` | Read data from pipe | | `PipeWriter` | Write data to pipe | | `ReadOnlySequence<T>` | Non-contiguous memory sequence | ## 2. Advantages - **Zero-copy**: Minimizes unnecessary memory copying - **Backpressure control**: Speed regulation between producer and consumer - **Memory pooling**: Automatic buffer reuse - **Async I/O**: Efficient asynchronous processing --- ## 3. Basic Usage ```csharp using System.IO.Pipelines; public sealed class PipelineProcessor { public async Task ProcessAsync(Stream stream) { var pipe = new Pipe(); // Run Writer and Reader concurrently var writing = FillPipeAsync(stream, pipe.Writer); var reading = ReadPipeAsync(pipe.Reader); await Task.WhenAll(writing, reading); } private async Task FillPipeAsync(Stream stream, PipeWriter writer) { const int minimumBufferSize = 512; while (true) { // Acquire buffer from memory pool Memory<byte> memory = writer.GetMemory(minimumBufferSize); int bytesRead = await stream.ReadAsync(memory); if (bytesRead == 0) break; ...

Details

Author
christian289
Repository
christian289/dotnet-with-claudecode
Created
7 months ago
Last Updated
6 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category