Humanizer icon indicating copy to clipboard operation
Humanizer copied to clipboard

Add TryDehumanizeTo with nullable

Open adamhathcock opened this issue 2 years ago • 1 comments

Adding a new method to feel slightly cleaner when testing if an enum can be dehumanized.

Addresses https://github.com/Humanizr/Humanizer/issues/769

adamhathcock avatar Jun 06 '22 07:06 adamhathcock

I believe the failures are because I changed the public API. Will wait to see what I should to fix, if approved.

adamhathcock avatar Jun 06 '22 08:06 adamhathcock

@adamhathcock LGTM. can you rebase and approve the api change

SimonCropp avatar Feb 15 '24 10:02 SimonCropp

I recently added the below, which should meet this requirement

public static TTargetEnum? DehumanizeTo<TTargetEnum>(this string input, OnNoMatch onNoMatch = OnNoMatch.ThrowsException)

SimonCropp avatar Feb 19 '24 01:02 SimonCropp

Thank you @SimonCropp

adamhathcock avatar Feb 19 '24 09:02 adamhathcock