In the following chunk of code:
public struct Nullable<T> : IFormattable, IComparable, INullable,
IComparable<Nullable<T>>
{
// ...
}
I understand that this struct is implementing these interfaces but I do not get the IComparable<Nullable<T>> part. What it means?
It means that you can compare any
Nullable<T>with another instance ofNullable<T>(for the sameT) in a strongly typed way. It will have a method like this:Note that the normal
Nullable<T>struct doesn’t have any of these interfaces. Personally I think it would be somewhat confusing to have anotherNullable<T>struct kicking around the place… I would suggest that if it’s in your power to do so, you rename this struct to something else. It’s also pretty strange thatTisn’t constrained using thewhere T : structconstraint…