Primary Constructor in C# 12 Explained! 🟢 New Feature in .NET Core 8 (C#12)

Поделиться
HTML-код
  • Опубликовано: 6 сен 2024

Комментарии • 10

  • @10Totti
    @10Totti 11 месяцев назад +1

    Best tutorial thanks!

  • @kaushikbhadani
    @kaushikbhadani 7 месяцев назад

    Very helpful. Thank you Nitish Kaushik!!

  • @TechLead-DOTNET
    @TechLead-DOTNET 11 месяцев назад

    Nicely Explained

  • @sachinrajput4746
    @sachinrajput4746 11 месяцев назад +1

    Thank you sir.
    Very helpful video

  • @user-fqlt
    @user-fqlt 11 месяцев назад

    Thanks for the content.
    Good tutorial . +1sub

  • @MohammadNikravan
    @MohammadNikravan 9 месяцев назад +1

    Assigning the primary constructor to a fullset property results in having two fields in your class - one for the field and one for the primary constructor. Unfortunately, we can't make the generated field as read-only in the primary constructor. If we assign parameter to a property it might cause the object to consume double the memory or at least bug prone as we have to make sure which one is used in the class. If you bypass the primary constructor to the parent, the field will exist in derived class too! This feature can be quite confusing, and I wish there was an option to disable it completely to prevent our team from using it.