ubergeek77's Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
NorthBySouth@programming.dev to Programming@programming.dev · 2 years ago

What′s new in C# 12: overview

pvs-studio.com

external-link
message-square
18
fedilink
38
external-link

What′s new in C# 12: overview

pvs-studio.com

NorthBySouth@programming.dev to Programming@programming.dev · 2 years ago
message-square
18
fedilink
It′s mid-fall which means a new version of C# is coming soon. It′s time to find out what updates will soon appear in the language. Although C#12 has fewer features than previous versions, it still...
  • Lucky@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    The new list initializing syntax is less boilerplate, no?

    • Corngood@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      Look how clunky it is to add support on a collection. Take the example here:

      https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/collection-expressions#collection-builder

      It involves adding a new builder class, and they actually have to reference the function by string name.

      It’s actually making me even more angry now that I look at it in detail.

      • Lucky@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        This is for custom collections, right? And you don’t even have to use it, you can keep using existing ctors for your custom collections

        Worse case scenario you keep doing what we’ve always had to do. But for the 99% of use cases we get a much more streamlined initializer, with extensions to use our own.

        I don’t see how that’s a bad thing

      • TehPers@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 years ago

        they actually have to reference the function by string name.

        This is true of a lot of the opt-in language features though, isn’t it? For example, you can just make an .Add method on any IEnumerable type and get collection initializer syntax supported for it, even as an extension method. The same works for Dispose on ref structs I believe, and I remember there being a few other places where this was true (GetAwaiter I think?).

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 144 users / day
  • 966 users / week
  • 2.45K users / month
  • 7.61K users / 6 months
  • 1 local subscriber
  • 21.3K subscribers
  • 2.31K Posts
  • 35.4K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.7
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org