Problems defining DTOs as records instead of classes?

We re-use our ServiceStack DTOs in our blazor web assembly application. Some of our API responses end up in a redux state store and I’d like to ensure the store is fully immutable so I’m toying with the idea of changing the DTOs to be records instead of classes.

Assuming ServiceStack will serialise records as well as classes, can you think of any other drawbacks or reasons not to do this?

As long as they’re not Record Structs which have different serialization behavior there shouldn’t be a problem, it should serialize it like any other POCO.

1 Like