String to Property

How to convert a string to a property

If you’re like to work with dynamic code and sometimes you only knew to runtime which property to execute on a specific object you have to convert the name to a property. If you have to do it more than once, it would be a good idea to create a function that handles this for you 💡.

Here is a simple template of a function which converts a property name to an object.
Hint: You have to dynamically cast the return object.

Leave a Reply

Your email address will not be published. Required fields are marked *