Is it possible to extend the verification / annotations of the configuration change code to correctly verify cases when you know that they are correct?
For example, I have a utility function that I know that satisfies certain conditions, for example:
static public bool IsValid(double? d) { return d != null && IsValid(d.Value); } static public bool IsValid(double d) { return !Double.IsNaN(d) && !Double.IsInfinity(d); }
So, this ensures that the nullable value is relevant, and I would like to see the “Possible System.InvalidOperationException” check not work for something like:
if (Utils.IsValid(nullableValue)) { DoSomethingWith(nullableValue.Value); }
Of course, I could turn off the / etc check, but can I extend the static typing to indicate that it would actually ensure that the value is not null?
(I believe that a related but too general question is that I should use a different static input check instead of a resharper that could handle it, but I will not ask to be afraid to be too wide!)
source share