In class Microsoft.Net.Http.Headers.ContentRangeHeaderValue
, there is a nullable value type property (long?
) that is decorated with a NotNullIfNotNull
attribute referencing itself (property Length
).
[NotNullIfNotNull(nameof(Length))]
public long? Length { get; private set; }
What is the purpose of this attribute in the context of a value type and what is the difference to simply omitting the attribute declaration?
Length
. Likewise, the property getter might have a "return value", but the property itself doesn't. (And the property getter definitely has no argument - contrary to VB.NET, that is not supported in C#.) – Torrey