<PackageReference Include="Google.Protobuf" Version="3.34.2" />

Google.Protobuf.Reflection.ReflectionUtil

static class ReflectionUtil
The methods in this class are somewhat evil, and should not be tampered with lightly. Basically they allow the creation of relatively weakly typed delegates from MethodInfos which are more strongly typed. They do this by creating an appropriate strongly typed delegate from the MethodInfo, and then calling that within an anonymous method. Mind-bending stuff (at least to your humble narrator) but the resulting delegates are very fast compared with calling Invoke later on.
namespace Google.Protobuf.Reflection { internal static class ReflectionUtil { public enum SampleEnum { X } public static SampleEnum SampleEnumMethod(); } }