C
C#12mo ago
Lyno

System.IO.Pipelines.ReadResult

why does the ReadResult struct have different properties exposed when i make it nullable?
No description
No description
5 Replies
Jimmacle
Jimmacle12mo ago
is it a struct?
Lyno
LynoOP12mo ago
yes
Jimmacle
Jimmacle12mo ago
then it's because ReadResult? is actually Nullable<ReadResult> and you have to access the Value property to get the actual ReadResult or use a conditional access operator etc to strip off the nullability
Lyno
LynoOP12mo ago
aah i see, thats odd ive never seen this before and my IDE isnt telling me about it but thank you appreciate the help
Jimmacle
Jimmacle12mo ago
it's the only way structs can be nullable, since a struct itself can never be null

Did you find this page helpful?