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 75 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

    M Offline
    M Offline
    Member 9167057
    wrote on last edited by
    #48

    Speak for yourself. I, for example, love ?? and switch expressions for making the syntax more readable, actually. They are concise, that is, there's less syntax to achieve the same thing, meaning less overhead to parse when reading.

    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

      H Offline
      H Offline
      Hassan F
      wrote on last edited by
      #49

      I believe they are competing with JS and python, because programming Meme always noted that python is fast in a single hello world sample, And others are not. The things I'm not sure about is why companies such as JetBrains also support those bad manners, and force users to change code to some of these style, while they just could ignore the user style (that may depend on the surranding and could change readability regarding to that)

      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

        B Offline
        B Offline
        BillWoodruff
        wrote on last edited by
        #50

        i hope it does not sound patronizing for me to i say that i "love" the discussion of "I hate recent C# versions" :) what a pleasure for an old man about to get new eyes, to savor the illuminations of many of CP's brightest-bulbs. Kornfeld's signature quote from Einstein: "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." Did make me chuckle ... as I thought of the tree-climbing mudskipper fish whose evolutionary history is detailed in Richard Dawkins' magisterial survey, "The Ancestor's Tale." (see "The Lungfishes' Tale").

        Quote:

        Another common name, ‘climbing fish’, comes from their habit of climbing mangrove trees looking for prey. They cling to the trees with the pectoral fins, aided by a kind of sucker which is made by bringing the pelvic fins together under the body.

        That boomeranging thought leads me to ponder if the evolution of C# ... leads us to believe we ... are ... smart. Is the "destiny" of C# (my favorite grab-bag of syntax and functionality masquerading as a "computer language") to have as much junk in its DNA as we, Homo Saps, do ? cheers, Bill

        «The mind is not a vessel to be filled but a fire to be kindled» Plutarch

        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

          R Offline
          R Offline
          RustyF
          wrote on last edited by
          #51

          If you don’t like more succinct code I would just stick with COBOL

          S 1 Reply Last reply
          0
          • P PIEBALDconsult

            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.

            M Offline
            M Offline
            MikeCLX
            wrote on last edited by
            #52

            We could call it something like B# and just copy and paste VB.NET, best language without the VB name stigma :) Oh wait we don’t want something easy that can do the same job better do we ;) KISS principle

            1 Reply Last reply
            0
            • P PIEBALDconsult

              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 Offline
              Graeme_GrantG Offline
              Graeme_Grant
              wrote on last edited by
              #53

              Then you wont like this valid c# syntax:

              if (jsonReader.TokenType is JsonTokenType.EndObject or JsonTokenType.EndArray)
              {
              //...
              }

              Old syntax:

              if (jsonReader.TokenType == JsonTokenType.EndObject || jsonReader.TokenType == JsonTokenType.EndArray)
              {
              //...
              }

              Graeme


              "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

              P 1 Reply Last reply
              0
              • P PIEBALDconsult

                I agree with a desire to not pollute the scope with rubbish. On the other hand, maybe defining a new scope is the better solution -- define a new Method. In so many cases, when a scope becomes polluted, it's a side-effect of not splitting the logic into enough granularity. It seems like maybe C# needs a with statement :D . Or maybe not, I've never liked the with statement in languages which include it. But if C# could get with right, maybe even I would use it.

                N Offline
                N Offline
                NiL
                wrote on last edited by
                #54

                There is “with” in C#: with expression - C# reference | Microsoft Docs[^]

                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

                  C Offline
                  C Offline
                  Carl_Sharman
                  wrote on last edited by
                  #55

                  Some of the new features I really like. Some I don't. The issue for me is not about what I may or may not like, but the ever-increasing complexity. People say 'just don't use the features if you don't like them'. This is fine if you mainly work on your own, but what if you work in a team? Or worse, lead one? You're likely to have a mix of people, some of whom want to explore all the new features, and some who are just learning. The latter group will really struggle because of the former - their learning curve will be much steeper, they will require more support, and they may even lose confidence and decide this isn't for them. There's a good article here[^] that explores this. TL;DR: langauge design is a balance between keeping up, and overloading with complexity. If you don't add new features, the language dies; but new features eventually make the langauge die from complexity. Personally, I understand the need to keep evolving the langauage, and really appreciate some of the additions, but I would prefer a slower, more measured evolution.

                  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

                    U Offline
                    U Offline
                    User 14060113
                    wrote on last edited by
                    #56

                    I missed the latest stuff, as we are still using Visual Studio 2017. But in my opinion, null propagation, named arguments and lambdas are useful and increase readability. I haven't tried switch expression, but they look like the same goes for them. I'm not familiar with ?[] and (_, _, area)=...! Does it mean you can return multiple values? Looks a little untidy compared to returning an object.

                    1 Reply Last reply
                    0
                    • Richard DeemingR Richard Deeming

                      Behzad Sedighzadeh wrote:

                      ... recent addings to the language ...

                      I'm not convinced by your definition of "recent"! :laugh:

                      Behzad Sedighzadeh wrote:

                      Named/optional arguments

                      Added in C# 4, which was released in April 2010.

                      Behzad Sedighzadeh wrote:

                      ?? ?[]

                      The null conditional / coalescing operators were added in C# 6 (July 2015).

                      Behzad Sedighzadeh wrote:

                      discards

                      C# 7 (March 2017)

                      Behzad Sedighzadeh wrote:

                      ()

                      Not entirely sure what you're referring to here. I'm going to guess that you mean value tuples, which were also added in C# 7 (March 2017).

                      Behzad Sedighzadeh wrote:

                      Switch expressions

                      C# 8 (September 2019). As with any addition to the language, nobody is forcing you to use them. If you want to stick to writing C# 1.0 code, then you're free to do so. It's only when you come to read someone else's code that you might need to understand the newer constructs - but even then, there are ways to convert the code to an older syntax.


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      K Offline
                      K Offline
                      Kate X257
                      wrote on last edited by
                      #57

                      I tend to agree with you on this one. C# has always been innovating, for the sake of trying new things or simply taking a swing to solve minor issues. I have no problem with Microsoft doing this. Most additions end up never being used in production anyway. As far as I can tell, they typically serve a very niche purpose and audience, and only rarely catch on.

                      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
                        maze3
                        wrote on last edited by
                        #58

                        null conditional in variables im still nah about var x = object?.value?.pointer1; tuples and tuple deconstructions are enjoy mainly from article from I think team creator about why he does not see many use tuples, and always just pairs which then is key/value pair, but tuples a bit more then that, and the syntax need to set and the deconstruct, so made it much easier. Can't find article but something like this [C# - Tuple Trouble: Why C# Tuples Get to Break the Guidelines | Microsoft Docs](https://docs.microsoft.com/en-us/archive/msdn-magazine/2018/june/csharp-tuple-trouble-why-csharp-tuples-get-to-break-the-guidelines) switch expression, similar, once know it clicks why would use instead of some other form makes sense. For me I dislike the syntax of most switch/break, is it : or brace :doh: , so I prefer if/else setups. then switch expression, for assigning a value, ohhh, yes. in comparison to if/else for value assign.

                        1 Reply Last reply
                        0
                        • Richard DeemingR Richard Deeming

                          Behzad Sedighzadeh wrote:

                          ... recent addings to the language ...

                          I'm not convinced by your definition of "recent"! :laugh:

                          Behzad Sedighzadeh wrote:

                          Named/optional arguments

                          Added in C# 4, which was released in April 2010.

                          Behzad Sedighzadeh wrote:

                          ?? ?[]

                          The null conditional / coalescing operators were added in C# 6 (July 2015).

                          Behzad Sedighzadeh wrote:

                          discards

                          C# 7 (March 2017)

                          Behzad Sedighzadeh wrote:

                          ()

                          Not entirely sure what you're referring to here. I'm going to guess that you mean value tuples, which were also added in C# 7 (March 2017).

                          Behzad Sedighzadeh wrote:

                          Switch expressions

                          C# 8 (September 2019). As with any addition to the language, nobody is forcing you to use them. If you want to stick to writing C# 1.0 code, then you're free to do so. It's only when you come to read someone else's code that you might need to understand the newer constructs - but even then, there are ways to convert the code to an older syntax.


                          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                          M Offline
                          M Offline
                          Mateusz Jakub
                          wrote on last edited by
                          #59

                          I think OP is only starting to see these in code bases. Not everyone is on latest/greatest day 1 :) adoption takes time. I have to also say something about "nobody forcing" is - try to write C# 1.0 code and get it past code review :) In the end everyone will have to just put up with it - if they like these features or not.

                          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

                            S Offline
                            S Offline
                            Simon Morrison 2022
                            wrote on last edited by
                            #60

                            Yes! I don't program for PCs any more any just stick to embedded in C largely because all the higher level languages have been similarly afflicted.

                            M 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
                              Michael Breeden
                              wrote on last edited by
                              #61

                              It used to be that C# could tell a story, but not now and that has greatly reduced the maintainability. A lot of this has to do with it going to Open Source with its rapid cycle of updates. There is some perceived benefit to constant change. No one seems to be factoring in cost. Is there any wonder that there is a talent shortage? There is no benefit to terseness if it reduces readability or maintainability. And don't think this stuff is never used. You always have some contractors on the bleeding edge and they just create problems for people that want to engineer reliable, maintainable solutions. Companies may think it's new and hot, but it is just difficult to maintain.

                              1 Reply Last reply
                              0
                              • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                                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

                                B Offline
                                B Offline
                                BryanFazekas
                                wrote on last edited by
                                #62

                                Kornfeld Eliyahu Peter wrote:

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

                                Nope, you're wrong. It's very easy to get in the position of supporting someone else's unreadable code. Of the last 8 to 10 C# releases, I've found about 90% of the new syntax to either be useless or counter-productive, as it makes the code unreadable. The C# team keeps making "additions", as it's their job, and for the most part they ran out of useful things to add years ago, but they don't let that stop them. :doh:

                                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

                                  I Offline
                                  I Offline
                                  ISanti
                                  wrote on last edited by
                                  #63

                                  I am delighted with some recent extensions, with others I'm indifferent and I don't hate any.

                                  Sorry for my bad English

                                  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
                                    MadGerbil
                                    wrote on last edited by
                                    #64

                                    This is in preparation for the launch of C# Classic, the new clean and back-to-basics version that everyone will be talking about in a couple of years. * Smaller footprint * Faster * Write clean, consistent code with your team The new C# Classic!

                                    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

                                      K Offline
                                      K Offline
                                      Ken Domino
                                      wrote on last edited by
                                      #65

                                      MS is trying to make C# look like nasty Python, JS, Go, and the rest of the bunch. So bad is "dotnet new console" that I had to write my own "Hello World" template. I do not program with top-level statements, and I never will. So bad is it that I will need to write a processor to parse new, terrible C# syntax, and refactor to old style.

                                      1 Reply Last reply
                                      0
                                      • N NiL

                                        There is “with” in C#: with expression - C# reference | Microsoft Docs[^]

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

                                        Which is not a with statement.

                                        N 1 Reply Last reply
                                        0
                                        • Graeme_GrantG Graeme_Grant

                                          Then you wont like this valid c# syntax:

                                          if (jsonReader.TokenType is JsonTokenType.EndObject or JsonTokenType.EndArray)
                                          {
                                          //...
                                          }

                                          Old syntax:

                                          if (jsonReader.TokenType == JsonTokenType.EndObject || jsonReader.TokenType == JsonTokenType.EndArray)
                                          {
                                          //...
                                          }

                                          Graeme


                                          "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

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

                                          Yeah, still just trying to attract VB developers.

                                          Graeme_GrantG 1 Reply 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