Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. I hate recent C# versions!

I hate recent C# versions!

Scheduled Pinned Locked Moved The Lounge
csharpquestion
92 Posts 48 Posters 78 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Behzad Sedighzadeh

    Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

    (_, _, area) = city.GetCityInformation(cityName);

    Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

    Behzad

    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu Peter
    wrote on last edited by
    #5

    Be more positive - learn these additions, but use only if fits... After all - they do not force you!!!

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid." ― Albert Einstein

    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

    L B 2 Replies Last reply
    0
    • B Behzad Sedighzadeh

      Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

      (_, _, area) = city.GetCityInformation(cityName);

      Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

      Behzad

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #6

      Some of them are pretty useful. For example:

         private void DroppedURL\_DoWork(object sender, DoWorkEventArgs e)
              {
              if (sender is BackgroundWorker worker)
                  {
                  ...
      

      Makes code much cleaner than the traditional way:

         private void DroppedURL\_DoWork(object sender, DoWorkEventArgs e)
              {
              BackgroundWorker worker = sender as BackgroundWorker;
              if (worker != null)
                  {
                  ...
      

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      P 1 Reply Last reply
      0
      • B Behzad Sedighzadeh

        Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

        (_, _, area) = city.GetCityInformation(cityName);

        Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

        Behzad

        L Offline
        L Offline
        lmoelleb
        wrote on last edited by
        #7

        I really like ?? since they made it possible to throw.

        something = myParameter ?? throw new ArgumentNullException(...)

        also handy in if statements. Optional arguments: better than 100 overloads, but as with everything use with care. (): If indeed value tuples - better than what we had (no more Item1, Item2) ?[]: Never used it, but I use ?. all the time -and it would be strange if ?[] wasn't available as well. Discards: Handy when needed - do not use them a lot, but when you do they make it clear right away. Switch expressions: Why oh why.... where they not added earlier. No more crappy switch statements full of returns or variable assignments - and a compiler warning when I am missing a state. I need to figure out how to use them nicely with enums though - I want a catch all that throws if not a defined enum value, but still want a warning if a new enum value is added and I do not handle it And nullable in general is of course the best thing since sliced bre... no, wait - I can just eat the bread without slicing it! Just too bad it is a bit crippled as we still need to call legacy code and the required keyword isn't coming before next version.

        N M 2 Replies Last reply
        0
        • L lmoelleb

          I really like ?? since they made it possible to throw.

          something = myParameter ?? throw new ArgumentNullException(...)

          also handy in if statements. Optional arguments: better than 100 overloads, but as with everything use with care. (): If indeed value tuples - better than what we had (no more Item1, Item2) ?[]: Never used it, but I use ?. all the time -and it would be strange if ?[] wasn't available as well. Discards: Handy when needed - do not use them a lot, but when you do they make it clear right away. Switch expressions: Why oh why.... where they not added earlier. No more crappy switch statements full of returns or variable assignments - and a compiler warning when I am missing a state. I need to figure out how to use them nicely with enums though - I want a catch all that throws if not a defined enum value, but still want a warning if a new enum value is added and I do not handle it And nullable in general is of course the best thing since sliced bre... no, wait - I can just eat the bread without slicing it! Just too bad it is a bit crippled as we still need to call legacy code and the required keyword isn't coming before next version.

          N Offline
          N Offline
          Nelek
          wrote on last edited by
          #8

          lmoelleb wrote:

          I need to figure out how to use them nicely with enums though - I want a catch all that throws if not a defined enum value, but still want a warning if a new enum value is added and I do not handle it

          Once you figure it out... write a tip ;) :-D

          M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

          1 Reply Last reply
          0
          • L lmoelleb

            I really like ?? since they made it possible to throw.

            something = myParameter ?? throw new ArgumentNullException(...)

            also handy in if statements. Optional arguments: better than 100 overloads, but as with everything use with care. (): If indeed value tuples - better than what we had (no more Item1, Item2) ?[]: Never used it, but I use ?. all the time -and it would be strange if ?[] wasn't available as well. Discards: Handy when needed - do not use them a lot, but when you do they make it clear right away. Switch expressions: Why oh why.... where they not added earlier. No more crappy switch statements full of returns or variable assignments - and a compiler warning when I am missing a state. I need to figure out how to use them nicely with enums though - I want a catch all that throws if not a defined enum value, but still want a warning if a new enum value is added and I do not handle it And nullable in general is of course the best thing since sliced bre... no, wait - I can just eat the bread without slicing it! Just too bad it is a bit crippled as we still need to call legacy code and the required keyword isn't coming before next version.

            M Offline
            M Offline
            Marc Clifton
            wrote on last edited by
            #9

            lmoelleb wrote:

            Switch expressions: Why oh why.... where they not added earlier.

            Yes, exactly!

            Latest Article:
            Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

            1 Reply Last reply
            0
            • B Behzad Sedighzadeh

              Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

              (_, _, area) = city.GetCityInformation(cityName);

              Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

              Behzad

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #10

              Maybe you would prefer VB 6.0? ;) Everything on your list is stuff that I use every day (except the ?[] - hardly ever have to specifically index something.

              Latest Article:
              Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

              1 Reply Last reply
              0
              • B Behzad Sedighzadeh

                Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

                (_, _, area) = city.GetCityInformation(cityName);

                Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

                Behzad

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #11

                Never hate. I don't use any features of C# newer than v3. The other week I found that I was using a Dictionary Initializer (which is a v6 feature), so I reverted it to a Collection Initializer (which is a v3 feature). I use the ?? operator (the null-coalescing operator, a C# 2 feature) occasionally, such as when interpreting a command line.

                Graeme_GrantG 1 Reply Last reply
                0
                • B Behzad Sedighzadeh

                  Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

                  (_, _, area) = city.GetCityInformation(cityName);

                  Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

                  Behzad

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #12

                  Just like many here I use them daily. Especially ?? and ?. Sure as hell beats if (x != null && x.Y != null && x.Y.Z != null)... Discards are useful when you don't need the variable (for example, when doing a TryParse, but only want to validate and not directly use the value). Tuples are great and also beat having to write one-off classes that you'll never use again. Are you sure you hate the features or that you hate having to keep up and not understanding them?

                  Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                  OriginalGriffO 1 Reply Last reply
                  0
                  • B Behzad Sedighzadeh

                    Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

                    (_, _, area) = city.GetCityInformation(cityName);

                    Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

                    Behzad

                    L Offline
                    L Offline
                    lmoelleb
                    wrote on last edited by
                    #13

                    You might want to watch this one: The functional journey of C# - Mads Torgersen - NDC Copenhagen 2022 - YouTube[^] It shows why some of these changes are made. Indeed the language is shifting to keep up with modern development, and if your mindset stays in the "traditional OO", then this just looks like bloat. You can also watch this one to see some of the things coming: Where’s C# headed? - Mads Torgersen - NDC Copenhagen 2022 - YouTube[^] Yep, more "functional programming" concepts are coming, and I am all for it.

                    1 Reply Last reply
                    0
                    • L Lost User

                      No, I get it. And that process isn't limited to C#.

                      D Offline
                      D Offline
                      den2k88
                      wrote on last edited by
                      #14

                      C++ joined the chat

                      GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

                      D 1 Reply Last reply
                      0
                      • B Behzad Sedighzadeh

                        Am I the only one who hates recent addings to the language? Some examples: ?? Named/optional arguments () ?[] discards :confused:

                        (_, _, area) = city.GetCityInformation(cityName);

                        Switch expressions The list can go on and on. They are trying to make programming much easier and at the same time are making the syntax more and more unreadable:mad::mad:

                        Behzad

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #15

                        The language needs to change as marketing decrees; otherwise it looks like it has halted in it's development. They can't sell something that is tested and tried, something that is reliable. It has to be shiny and new, not boring. That is also the reason VB6 did not die yet. It is tested, tried, reliable and doesn't change. As hard as we try, we cannot kill the beast.

                        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                        Sander RosselS M 2 Replies Last reply
                        0
                        • Sander RosselS Sander Rossel

                          Just like many here I use them daily. Especially ?? and ?. Sure as hell beats if (x != null && x.Y != null && x.Y.Z != null)... Discards are useful when you don't need the variable (for example, when doing a TryParse, but only want to validate and not directly use the value). Tuples are great and also beat having to write one-off classes that you'll never use again. Are you sure you hate the features or that you hate having to keep up and not understanding them?

                          Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                          OriginalGriffO Offline
                          OriginalGriffO Offline
                          OriginalGriff
                          wrote on last edited by
                          #16

                          Sander Rossel wrote:

                          Are you sure you hate the features or that you hate having to keep up and not understanding them?

                          That may be the case. It does seem to get harder to constantly update your skillset, but every time I've done it so far it's been well worth it in the long run. The last big jump update was abandoning C++ (where feature creep is even worse than in C#) in favour of C#. And I have never regretted it: the speed of development and the clarity of the code is so much better - and that impacts the reliability and maintainability of the code as well.

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                          1 Reply Last reply
                          0
                          • L Lost User

                            The language needs to change as marketing decrees; otherwise it looks like it has halted in it's development. They can't sell something that is tested and tried, something that is reliable. It has to be shiny and new, not boring. That is also the reason VB6 did not die yet. It is tested, tried, reliable and doesn't change. As hard as we try, we cannot kill the beast.

                            Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #17

                            Eddy Vluggen wrote:

                            As hard as we try, we cannot kill the beast.

                            Or can't we kill the beast because some of us aren't trying? I know a developer who'd still start new VB6 projects in 2022 because that's all he knows, it works and clients are satisfied. Why learn something new when the old still works? This person also uses hidden controls on a form to store values, instead of using variables like the rest of us do. Also, because it works, so why try harder? He'll be retiring later this year and he gets to keep all of his software and clients because no one, and I mean no one, could ever unearth whatever it is that he built. There are plenty of people like that, sort of technical quakers. We had technology in 1999, which is what God intended, and we need nothing newer.

                            Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                            L 2 Replies Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              Some of them are pretty useful. For example:

                                 private void DroppedURL\_DoWork(object sender, DoWorkEventArgs e)
                                      {
                                      if (sender is BackgroundWorker worker)
                                          {
                                          ...
                              

                              Makes code much cleaner than the traditional way:

                                 private void DroppedURL\_DoWork(object sender, DoWorkEventArgs e)
                                      {
                                      BackgroundWorker worker = sender as BackgroundWorker;
                                      if (worker != null)
                                          {
                                          ...
                              

                              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #18

                              Umm ... is predates as, yes? as is intended as an improvement over is.

                              L 1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                Umm ... is predates as, yes? as is intended as an improvement over is.

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #19

                                `is` with a built-in `as` is new though

                                P 1 Reply Last reply
                                0
                                • Sander RosselS Sander Rossel

                                  Eddy Vluggen wrote:

                                  As hard as we try, we cannot kill the beast.

                                  Or can't we kill the beast because some of us aren't trying? I know a developer who'd still start new VB6 projects in 2022 because that's all he knows, it works and clients are satisfied. Why learn something new when the old still works? This person also uses hidden controls on a form to store values, instead of using variables like the rest of us do. Also, because it works, so why try harder? He'll be retiring later this year and he gets to keep all of his software and clients because no one, and I mean no one, could ever unearth whatever it is that he built. There are plenty of people like that, sort of technical quakers. We had technology in 1999, which is what God intended, and we need nothing newer.

                                  Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #20

                                  Sander Rossel wrote:

                                  I know a developer who'd still start new VB6 projects in 2022 because that's all he knows, it works and clients are satisfied. Why learn something new when the old still works?

                                  Well, that's the entire problem; it is reliable, doesn't change, and does exactly as intended for years on end. If his clients are satisfied, then they'll pay, even if the language is not "officially" supported. To make it worse; this person will have experience, and will have solved these problems before, where we are confronted with changes to the language each six months.

                                  Sander Rossel wrote:

                                  This person also uses hidden controls on a form to store values, instead of using variables like the rest of us do. Also, because it works, so why try harder?

                                  I worked for someone who wrote our new flagship in C#, while I maintained the VB6 version, who put 31 booleans in a string-field in the database and claimed it to be efficient. You can be an idiot in any language, and I met some academically trained idiots too.

                                  Sander Rossel wrote:

                                  He'll be retiring later this year and he gets to keep all of his software and clients because no one, and I mean no one, could ever unearth whatever it is that he built.

                                  You might want to learn from that :)

                                  Sander Rossel wrote:

                                  There are plenty of people like that, sort of technical quakers. We had technology in 1999, which is what God intended, and we need nothing newer.

                                  We do not change for change's sake. Improvements, very welcome; but both the UI-changes since beveled components and the changes to the language specification (with breaking cost-inducing changes) are mostly changes without improvements. There's a cost to everything :)

                                  Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    `is` with a built-in `as` is new though

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #21

                                    Never heard of it.

                                    L OriginalGriffO 2 Replies Last reply
                                    0
                                    • P PIEBALDconsult

                                      Never heard of it.

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #22

                                      Maybe under other names? - `is` with "declaration pattern" - Three-operand `is` - C#7-`is`

                                      P 1 Reply Last reply
                                      0
                                      • D den2k88

                                        C++ joined the chat

                                        GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

                                        D Offline
                                        D Offline
                                        DRHuff
                                        wrote on last edited by
                                        #23

                                        Agreed!

                                        If you can't laugh at yourself - ask me and I will do it for you.

                                        1 Reply Last reply
                                        0
                                        • L Lost User

                                          Maybe under other names? - `is` with "declaration pattern" - Three-operand `is` - C#7-`is`

                                          P Offline
                                          P Offline
                                          PIEBALDconsult
                                          wrote on last edited by
                                          #24

                                          Seems kludgey. We need a whole new language with everything we've learned over the past twenty years included, with cleaner syntax, rather than bits stuck on at odd angles.

                                          L M 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups