# Data class get all components/properties

**URL:** <https://discuss.kotlinlang.org/t/data-class-get-all-components-properties/25409>\
**Category:** Language Design\
**Created:** [August 8, 2022, 6:37pm UTC](https://discuss.kotlinlang.org/t/data-class-get-all-components-properties/25409 "2022-08-08T18:37:41Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![Psijic](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/psijic/32/2227_2.png) [@Psijic](https://discuss.kotlinlang.org/u/Psijic)\
**Post date:** [August 23, 2022, 10:57am UTC](https://discuss.kotlinlang.org/t/data-class-get-all-components-properties/25409/27 "2022-08-23T10:57:48Z")

</div>

You can use Any as well as the specific type. Just add something like:

```auto
when (value) {
  is String -> foo()
  is Number -> bar()
  is MyInterface -> next()
}

```

---

_[View the full topic](https://discuss.kotlinlang.org/t/data-class-get-all-components-properties/25409)._
