Skip to content

Add support for NRT #511

@fiseni

Description

@fiseni

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions