C# 9.0 Init Only Property Setters | New in .NET 5 Series (Part 2 / 3)

Опубликовано: 24 Февраль 2021
на канале: Ed Andersen
2,406
77

Watch a practical example of C# 9 init only setters, introduced in .NET 5, in action.

Part 3:    • C# 9.0 Pattern Matching Enhancements ...  

The Microsoft docs state:

"Init only setters provide consistent syntax to initialize members of an object. Property initializers make it clear which value is setting which property. The downside is that those properties must be settable. Starting with C# 9.0, you can create init accessors instead of set accessors for properties and indexers. Callers can use property initializer syntax to set these values in creation expressions, but those properties are readonly once construction has completed. Init only setters provide a window to change state. That window closes when the construction phase ends. The construction phase effectively ends after all initialization, including property initializers and with-expressions have completed."


Смотрите видео C# 9.0 Init Only Property Setters | New in .NET 5 Series (Part 2 / 3) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Ed Andersen 24 Февраль 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,406 раз и оно понравилось 77 людям.