How can I check if an attribute of a class is type of List? The following code snippet is what I want but it doesn't work.
class MyClass(val attr:List<String>)
fun main(args: Array<String>) {
var prop = MyClass::attr
if(prop.returnType.classifier is List<*>)
println("Property is type of List")
}
Aucun commentaire:
Enregistrer un commentaire