Does anyone have concrete information on how C# handles comparisons with Nullable<T>
types when one side of the comparison is null?
As I understand from experimenting with the compiler, it seems that the comparison always returns false, but I can't find any documentation to back that up. Is this a real feature of the language (and thus something I can count on), or is this an implementation detail that might change in future versions?
In other words, does the following method returning true imply y.HasValue
, and can you point me to some documentation that proves that it does?
public bool foo(int x, int? y)
{
return x < y;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…