如何检查类的属性是否为列表类型?下面的代码片段是我想要的,但它不起作用。
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")
}
Run Code Online (Sandbox Code Playgroud)