-
Notifications
You must be signed in to change notification settings - Fork 49
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 for .NET Standard 2.0 and 2.1 #513
Changes from 41 commits
850348c
3b7c839
c4c1994
b1d53c9
b190aae
1560f40
dca0c0e
c61d0c3
117fe37
fcdec62
4c8cae6
c501259
76c3bc7
42e8255
91ffcda
2013c0a
99c05c8
055d693
abc6b02
f6b55ee
3168197
123514f
4dbcd84
b206685
83f02c5
5516b20
2cee902
8cf5f8a
2314492
dec2a26
b53cd08
6e6db0c
5cebd56
6dd35d6
0ce7c80
cf213e6
1d2166a
e0c282f
2ea8828
4b5a94c
c56cc54
7bf683b
74b3b9c
9695a1d
695bc6e
bc2aadc
ebce217
6641414
fb24f7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,7 +375,11 @@ public void Serialize(IBufferWriter<byte> bufferWriter, T value) | |
return (T)(object)Encoding.UTF8.GetString(buffer); | ||
} | ||
|
||
#if NETSTANDARD2_0 | ||
var span = buffer.IsSingleSegment ? buffer.First.Span : buffer.ToArray(); | ||
#else | ||
var span = buffer.IsSingleSegment ? buffer.FirstSpan : buffer.ToArray(); | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another potential candidate for ext-method-consolidation is I should note that, AFAIR, if the extension method is internal, Resharper/Rider can always let team 're-dupe' the callsites later easily if ppl change their minds. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
if (typeof(T) == typeof(DateTime) || typeof(T) == typeof(DateTime?)) | ||
{ | ||
|
@@ -621,7 +625,11 @@ public void Serialize(IBufferWriter<byte> bufferWriter, T value) | |
{ | ||
if (readOnlySequence.IsSingleSegment) | ||
{ | ||
#if NETSTANDARD2_0 | ||
bufferWriter.Write(readOnlySequence.First.Span); | ||
#else | ||
bufferWriter.Write(readOnlySequence.FirstSpan); | ||
#endif | ||
} | ||
else | ||
{ | ||
|
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.
Stupid question: would it be cleaner to put the logic shifts in
IsNotCompletedSuccessfully()
extension method and just aggressive inline? Or would it be too ugly for how shims should be composed?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.
yes good point, fewer
#if
the better!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.
done