Use generic MethodInfo.CreateDelegate for explicitly cast delegates

Proprietary

Replace a resolved MethodInfo.CreateDelegate(typeof(T), optionalTarget) with CreateDelegate<T>(optionalTarget) when the same explicit delegate cast surrounds the call and all effective targets are .NET5+. Preserve receiver, target evaluation, type attribution and cast identity. Keep soft/mismatched casts, dynamic types, old language syntax, ambiguous owners, source shadows, comments, deferred contexts and conditional snapshots unchanged.

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

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