Add support for NRT
fiseni opened this issue · 1 comments
fiseni commented
Hi,
It would be nice to enable the NRT in the library. It will offer a better experience for the consumers and fix some subtle issues.
But. I don't think we'll be able to do that with the current structure (at least I couldn't). I'd suggest constraining the TValue
generic parameter to struct
.
public abstract class SmartEnum<TEnum, TValue> :
ISmartEnum,
IEquatable<SmartEnum<TEnum, TValue>>,
IComparable<SmartEnum<TEnum, TValue>>
where TEnum : SmartEnum<TEnum, TValue>
where TValue : struct, IEquatable<TValue>, IComparable<TValue>
Conceptually, that makes sense. But, it would require some substantial refactoring and will be a major breaking change. I'm not sure if anyone is using reference types as enum values, but there are such users probably.