There is no way to be sure that a nullable type will not return null
, however consider the framework is stable in terms of code changes, I will tend to make an informed decision by looking at how the property or method you are calling works using ILSpy or JustDecompile.
In your example it would appear that null
could not be returned as the constructor for ImageFormat accepts a Guid
and assigns it to a private field.
Depending on what you are doing with the property it may be worth checking:
- That a
StatusException
is not thrown on accessing the property.
- That
ImageFormat
equals a format you are expecting as it could represent a image format that neither GdiPlus or .NET is "aware" of.