-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support events. #94
Support events. #94
Conversation
#if NET6_0_OR_GREATER | ||
stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); | ||
#else | ||
stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do await using var
vs using var
here (and drop the code in the finally
block)?
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER | ||
await stream.WriteAsync(s_errorEventLine, cancellationToken).ConfigureAwait(false); | ||
#else | ||
await stream.WriteAsync(s_errorEventLine.ToArray(), 0, s_errorEventLine.Length, cancellationToken).ConfigureAwait(false); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defining an extension method (for WriteAsync
on old frameworks) that takes Memory<T>
and uses MemoryMarshal.TryGetArray
(or ToArray
, but I assume the former should work) can avoid needing to sprinkle all these #if
through the rest of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.