C# 12 Primary Constructors

Поділитися
Вставка
  • Опубліковано 23 лис 2023
  • Getting bored of having to write code in triplicate just to initialize a field? Try primary constructors.
    Source code available at:
    github.com/JasperKent/Primary...
    Related videos:
    - C#9 Records • C# 9 Records
    Topics include:
    - TypeScript parameter properties
    - Primary constructors in records
    - Calling primary constructors
    - Primary constructors in classes and structs
    - Using Primary constructor fields in classes
    - When not to use primary constructors
    - Primary constructors and dependency injection
    - Primary constructors and readonly fields
    - Overloading primary constructors
  • Наука та технологія

КОМЕНТАРІ • 6

  • @abdelazizshaban5190
    @abdelazizshaban5190 17 днів тому +1

    You're underrated, Thank you

  • @CodingTutorialsAreGo
    @CodingTutorialsAreGo  6 місяців тому +4

    Do think the drawbacks of primary constructors (like missing 'readonly') outweigh the benefits? Leave a comment.
    Source code available at: github.com/JasperKent/Primary-Constructors
    Remember to subscribe at ua-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html
    And if you liked the video, click the 👍.

  • @DNI404
    @DNI404 6 місяців тому +3

    At this moment primary constructors feature looks a bit unfinished, I hope they will properly implement it in the next version. Thanks for the video!

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  6 місяців тому +2

      I’m finding that for other features too. Next week’s video highlights a big performance problem with the new spread operator.

  • @zaharivaklinov
    @zaharivaklinov 6 місяців тому +5

    This is a nice observation of these couple of C# features. Will you be doing a review of any .NET 8 or other C#12 aspects?