``` object Users { val id: Long = 10 val ...
# announcements
r
Copy code
object Users  {
    val id: Long = 10
    val name : String ="name"
    val cityId : Long = 42
}


fun main(args: Array<String>) {
    slice(Users::name)
}

fun slice(vararg properties: KProperty<Users>) {
    properties.forEach { println(it.name) }
}
what should be
properties
type that will accept only Users properties?
t
KProperty1<Users, *>
should do the trick, but only if
class Users
tip:
val x = Users::name
and turn on type hints, you'll see that for
object
it's
KProperty0<String>
the only way I know to get an instance is reflection:
val x : KProperty1<Users, *> = Users::class.declaredMemberProperties.first { it.name == "name" } // val x = Users::name -ish