What is Record in C# 9? | What is init in C#?

preview_player
Показать описание
Hello guys, in this video you are going to learn what is Record in C# 9.0? As you know that Record is introduced with C# version 9.0 and with this record there is another init keyword was introduced. You might be wondering about what is init in C# 9? Let me tell you that init can be used at the place of the set during the initialization of the property in C# class models or record models. Init allows a variable to be readonly or immutable, which means values can be set in properties during object creation with new keywords or it can be initialized inside the constructor.

Record allows:
- Immutability (using init keyword in properties)
- Value equality (compares object values in records unlike classes)
- Nondestructive mutation (Record allow to create a new object from another object and update only selected properties value)
- Support Inheritance (only between records)

#record #init #csharp

--------- Contents of this video --------------------
00:00 - Intro | What is records in C# 9
01:23 - Intro | What is init in C# 9
01:54 - Create Console Project to Understand Record in C# 9 and .Net 5
03:36 - Create Record with properties having Init keyword (readonly and immutable properties)
05:43 - Create an object of record in C# 9
08:28 - Assign the value to record properties during object creation
09:17 - C# Record value equality or comparison of objects
12:54 - C# Record Nondestructive mutation or objects
15:45 - C# Record Inheritance
19:40 - Inherit Class into a Record and Record into a class
20:32 - Outro

Go to this link to take the test to identify yourself.

Laptop Used for Creating the Video:

Best Laptops for Programming in the Market:

Mic used for creating the video:

Best Mic for Recording:

Best Mic for YouTuber:

Go to the below link to subscribe to our channel:

Book for learning ASP.NET Core and Design Patterns:
Рекомендации по теме
welcome to shbcf.ru