masto.ai is one of the many independent Mastodon servers you can use to participate in the fediverse.
A general Mastodon server for all languages.

Administered by:

Server stats:

2.2K
active users

Just saw something really strange that I have never seen before as a dev:
Using a `record` for a service that is registered in DI.

Are there any devs here that do this and can tell me why? Any huge benefits I'm not seeing here?

@dr_cox1911 looking at the MS documentation for records it seems it’s mostly syntax on top of a class. So no value to go a wholesale change things.

But it does have formatting for easier debug display, automatic equality comparisons, some editing features for immutability. So it could be easier/quicker to define things that way and not need to add a bunch of extra methods that are already automatically generated.

Or just could be habit. Record is very simple syntax for a data transfer/storage class.

Dr_Cox1911

@cambirch Thanks for your reply, I know and use records for the scenarios that your last sentence depict: data

For this they are awesome, just don't really see the appeal to use them for my services.