Replies: 1 comment 3 replies
-
Moved to csharplang since this suggests a the nullable reference types language feature. I think this attribute would be tricky for a number of reasons. First is that nullable analysis doesn't actually track that a value is null--it tracks that it may be null. So it would actually be difficult for us to do the right thing in a scenario like the following: void M(PointCollection points)
{
Func<double, bool>? predicate = null;
var xValue = points.FirstXValue(predicate);
xValue.Value.ToString(); // shouldn't warn
} When I think it's worthwhile to gauge whether there's a wider interest/benefit from this, however, my instinctive thought about the scenario you've shared here is that an overload |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Considering this code, there's no good attribute that can be used to indicate the nullability of the returned value:
I'd be happy to help out with development, but haven't worked much with Roslyn code before (just making analyzers) so will likely require some help with the prototype.
Beta Was this translation helpful? Give feedback.
All reactions