vendredi 15 janvier 2016

Get function by name dynamically in Kotlin

How can I dynamically get a function by name in Kotlin ?

i.e:

fun myFunc11() { println("Very useful function 11") }

val funcName = "myFunc" + 11
val funcRef = getFunction(funcName)

funcRef()





Aucun commentaire:

Enregistrer un commentaire