is there a way to conveniently save an enum type a...
# announcements
e
is there a way to conveniently save an enum type and then later retrieve all the name of that enums?
m
If it's on the JVM use
val foo: KClass<Enum<*>>
and then
foo.java.enumConstants.map { it.name }
for the names.
e
how can I set
foo
?
m
foo = MyEnum::class
e
that is, how to retrieve the
Kclass
I'm dummy, I was looking for
KClass
returning type, but
.class
doesnt show anything..
anyway, thanks Marc, it works flawness
👍 1
n
or use
Enum.values()
Copy code
enum class Foo { A, B, C }
val names =  Foo.values().map { it.name }
d
enumValues<Foo>()