Use generic Enum.GetName for typed source enum values

Proprietary

Replace resolved Enum.GetName(typeof(T), value) with GetName<T>(value) only when value is attributed to the identical nonnullable closed source enum owned by the current project and all effective targets support .NET5+. Retain the value expression, padding, call identity and original string return attribution. Keep boxed, numeric, string and nullable values, external/open types, unknown owners/imports, source shadows, comments, deferred contexts and snapshots unchanged.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.UseGenericEnumGetNameForSourceEnums
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.UseGenericEnumGetNameForSourceEnums

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.