C# 9 Record Types

preview_player
Показать описание
C# 9.0 introduces record types, which are a reference type that provides synthesized methods to provide value semantics for equality. Records are immutable by default. Record types make it easy to create immutable reference types in .NET. C# forced you to write quite a bit of extra code to create immutable reference types. Records provide a type declaration for an immutable reference type that uses value semantics for equality.

In this video, I show you what we need to do prior to C# 9 in order to get similar functionality and then introduce C# 9 Record types, so that you can truly appreciate this new feature.
Рекомендации по теме
Комментарии
Автор

Great content as always Shiv. Appreciate your efforts.

ivanvincent
Автор

As always excellent video, Shiv. Thoroughly enjoyed it.

sumitmore
Автор

Omg, this is the best source of information about records. When the records came out, everyone said it was a great feature, but no one could describe it in a decent way. I've read and looked at many sources, but it's only in this video that I see the value of the records. Are you going to use DTO records instead of DTO classes in future systems?

marcinsiennicki
Автор

Great videos as always Shiv! I always enjoy watching your videos in the evening after work!

hansrudolf
Автор

we miss you Shiv :(
God bless you <3

MrJonnis
Автор

You don't use ToString() in production code? I do that all the time. I do it when I want to convert an object from a DataTable to a string. I do it when I want to convert a DateTime to a string. What's the problem with doing this?

gibbytravis
Автор

Nice video, but thought for the GetHashCode() you might like something more like:

return this.Prop1?.GetHashCode() ?? 0 ^
this.Prop2?.GetHashCode() ?? 0 ^
this.Prop3?.GetHashCode() ?? 0 ^
this.Prop4?.GetHashCode() ;

Handles null and must faster to XOR vs multiply :)

dand
Автор

Could you please make a video about the non-continuation of the ability to build a WCF server on .net core and .net 5.
Will gRPC take over all WCF usages, or some other technology will be better for example graphQL?

marcinsiennicki
Автор

Hey Shiv, thanks for sharing your thoughts on this feature. Silly question - when you were doing operator overloading the not equals symbol looked a little like "=/=", instead of "!=". What is that about?

Scorbffeghy
Автор

Great explanation! Would be even better if you'd condense it like x3 :)

Mnsgnr