# Ignoring certain properties when generating equals(), hashCode(), etc

**URL:** <https://discuss.kotlinlang.org/t/ignoring-certain-properties-when-generating-equals-hashcode-etc/2715>\
**Category:** Support\
**Created:** [May 20, 2017, 9:31am UTC](https://discuss.kotlinlang.org/t/ignoring-certain-properties-when-generating-equals-hashcode-etc/2715 "2017-05-20T09:31:06Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![McPringle](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/mcpringle/32/4789_2.png) [@McPringle](https://discuss.kotlinlang.org/u/McPringle)\
**Post date:** [February 19, 2018, 12:24am UTC](https://discuss.kotlinlang.org/t/ignoring-certain-properties-when-generating-equals-hashcode-etc/2715/3 "2018-02-19T00:24:11Z")

</div>

**From the documentation:**

_Note that the compiler only uses the properties defined inside the primary constructor for the automatically generated functions. To exclude a property from the generated implementations, declare it inside the class body._

Your example has to look like this:

```
data class Product(
    val name: String,
    val manufacturer: String) {
    val id: Int
}

```

For more information take a look at: [https://kotlinlang.org/docs/reference/data-classes.html#properties-declared-in-the-class-body](https://kotlinlang.org/docs/reference/data-classes.html#properties-declared-in-the-class-body)

---

_[View the full topic](https://discuss.kotlinlang.org/t/ignoring-certain-properties-when-generating-equals-hashcode-etc/2715)._
