-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Stream Span/Buffer-based APIs #22820
Comments
💡 Can start writing |
++ for the actual right way 😄 |
@stephentoub there's more than a slim chance that I'm missing something but I don't understand the purpose of the new Span-based Read/Write methods on Stream since the default implementations seem to introduce overhead above that of the array based overloads. When would/should I choose to call the Span-based versions? |
Those default implementations only exist for cases where derived Streams don't override them. Every important stream in .NET Core does override them, and once this ships, we hope/expect other streams will as well. |
Thanks @stephentoub, I did wonder if it was just so you could have extra flexibility for Stream derivatives but I still couldn't understand where you would get a benefit from this flexibility (in the Stream.Read/Write case, I can see benefit in other areas). What would be a good use case for choosing MemoryStream.Read(Span..) over the overload that takes an array? |
a) You have a span as input. |
@tdinucci The use of |
Separated out of https://github.com/dotnet/corefx/issues/21281 for tracking purposes.
The text was updated successfully, but these errors were encountered: