Skip to content

Conversation

@01Vladimir10
Copy link

…emoryStream

@mlhpdx
Copy link
Owner

mlhpdx commented Feb 1, 2023

Just FYI, I'm looking at this. The pooled memory stream seems like a win (here and in the seekable-s3-stream code as well).

@inbarbarkai
Copy link

I recommend getting a factory method in the constructor to create memory streams.
That way you can inject the manager you want to use.

Example:

class MyClass
{
    private readonly Func<MemoryStream> _streamFactory;

    public MyClass(Func<MemoryStream> streamFactory = null)
    {
        _streamFactory = streamFactory ?? () => new MemoryStream();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants