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.3K
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

@tpetrina Thanks for pointing out that usecase, that's one advantage I thought of as well. I kinda had an argument with someone who uses records now for everything and that I find problematic. E.g. you can't inherit from libs like with records.

For the usecase you blogged about I think it's nice, but with .Net8 I would still prefer classes with primary constructors I guess.

@dr_cox1911 I agree, but when I wrote this (and still) .NET 8 is not something I can use in production.
Also, side note: C# is becoming too complex :/