I’ve found a couple scenarios where it would be nice to unpack the components of a data class instance to a list.
Unfortunately, I don’t think there is any way to do this generically without language support, because:
- I don’t know of a way to add extension methods to data classes.
- Would have to use code generation or reflection to call all componentN() methods.
I wonder if others would find such a thing useful?