You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently writing a serializer and am looking at nullable reference types.
I'm using NullabilityInfoContext which works fine in most scenarios. However, there is one scenario where I don't know how to get the information I need.
I want to determine the nullability of the items in a collection.
Assume the following classes (with nullable reference types enabled):
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently writing a serializer and am looking at nullable reference types.
I'm using
NullabilityInfoContext
which works fine in most scenarios. However, there is one scenario where I don't know how to get the information I need.I want to determine the nullability of the items in a collection.
Assume the following classes (with nullable reference types enabled):
For the first two properties, I can get the correct/desired nullability information like this:
But when I determine nullability info for
Value3
I just get this:I even tried this:
But with this I get
Unknown
forinfo.GenericTypeArguments[0].ReadState
.Is there any way to get the information I'm looking for with
NullabilityInfoContext
(on .NET 8)?Beta Was this translation helpful? Give feedback.
All reactions