Skip to content

An Enum, unknown at compile time, can no longer be used with EnumHumanizeExtensions.Humanize #1653

@imm-mcc

Description

@imm-mcc

First off, thanks for the great package! It's incredibly useful.

I updated to v3 of Humanizer and I was no longer able to compile, with several of the following errors:

The type 'Enum' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'EnumHumanizeExtensions.Humanize<T>(T, LetterCasing)'

After some investigation, it looks like commit 7e7e960 changed the signature of the extension method from:

public static string Humanize(this Enum input, LetterCasing casing)

to:

public static string Humanize<T>(this T input, LetterCasing casing) where T : struct, Enum

thereby requiring the concrete type of the Enum to be known at compile time.

Is this an intentional change? If so, are there any workarounds that you'd suggest?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions