Source

Alt text:

A screenshot from the linked article titled “Reflection in C++26”, showing reflection as one of the bullet points listed in the “Core Language” section

  • @GetOffMyLan
    link
    8
    edit-2
    1 day 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.