C++ try not to add footguns challenge (impossible)
GetOffMyLan @ GetOffMyLan @programming.dev Posts 0Comments 332Joined 12 mo. ago
GetOffMyLan @ GetOffMyLan @programming.dev
Posts
0
Comments
332
Joined
12 mo. ago
You can also optimize this a bit.
You can use Activator.CreateInstance instead of reflecting and invoking the constructor.
You can also call MethodInfo.Invoke, you don't need to create a delegate.
Also worth noting that Source Generators have replaced the need for reflection in many cases.