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. VS 2022 a genuine wow moment

VS 2022 a genuine wow moment

Scheduled Pinned Locked Moved The Lounge
visual-studiocsharpjavascriptcom
39 Posts 20 Posters 0 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.
  • D dan sh

    I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

    // Replace all the commas that are between double quotes
    char[] linechars = line.ToCharArray();
    bool isInQuotes = false;

    for (int i = 0; i < linechars.Length; i++)
    {
    if (linechars[i] == '"')//This was predicted by Visual Studio

    This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

    "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

    D Offline
    D Offline
    dandy72
    wrote on last edited by
    #16

    Now redo another block of code, but change "commas" in your comment to something else...then as you're typing the actual code, see if it picks up what your comment said as you're suggesting...

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

      It is amazing... until it is not... Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

      “Real stupidity beats artificial intelligence every time.” ― Terry Pratchett, Hogfather

      D Offline
      D Offline
      Dan Neely
      wrote on last edited by
      #17

      Kornfeld Eliyahu Peter wrote:

      Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

      I had more obviously wrong suggestions than cases where it generated what I wanted, but that's not why I turned it off after a few weeks. I pulled the plug because about 5-10% of the suggestions were dangerously wrong. Things that looked OK at first glance, but which had subtle logic errors in them. Trying to debug my own wrong think is bad enough, when the code running is ever so slightly off of what I intended was far worse.

      Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

      M 1 Reply Last reply
      0
      • D dandy72

        Now redo another block of code, but change "commas" in your comment to something else...then as you're typing the actual code, see if it picks up what your comment said as you're suggesting...

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #18

        Yes it does! It does not figure what the new condition should be but it at least does not recommend checking for quote. I love VS. Mostly due to other IDEs I need to use.

        "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

        1 Reply Last reply
        0
        • D dan sh

          I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

          // Replace all the commas that are between double quotes
          char[] linechars = line.ToCharArray();
          bool isInQuotes = false;

          for (int i = 0; i < linechars.Length; i++)
          {
          if (linechars[i] == '"')//This was predicted by Visual Studio

          This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

          "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

          D Offline
          D Offline
          Daniel Pfeffer
          wrote on last edited by
          #19

          With the possible exception of auto-complete for method names etc., I distrust such suggestions. No IDE, irrespective of how much "AI" it is using, can truly understand my thought processes.

          Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

          K 1 Reply Last reply
          0
          • D Daniel Pfeffer

            With the possible exception of auto-complete for method names etc., I distrust such suggestions. No IDE, irrespective of how much "AI" it is using, can truly understand my thought processes.

            Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

            K Offline
            K Offline
            k5054
            wrote on last edited by
            #20

            Is that a reflection of the state of AI, or your thought processes, I wonder.

            Keep Calm and Carry On

            D 1 Reply Last reply
            0
            • Greg UtasG Greg Utas

              Perhaps you or someone else can explain this {get; set;} thing to me. There are times when having a getter is appropriate, but far fewer times when having a setter is appropriate. I'm surprised that they make it so easy to mindlessly provide one.

              Robust Services Core | Software Techniques for Lemmings | Articles
              The fox knows many things, but the hedgehog knows one big thing.

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

              Greg Utas wrote:

              There are times when having a getter is appropriate, but far fewer times when having a setter is appropriate. I'm surprised that they make it so easy to mindlessly provide one.

              Agreed, however in the 99% of the cases that I work with, I'm either serializing/deserializing JSON or working with EF or Linq2SQL, both of which require setters on the model.

              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
              • K k5054

                Is that a reflection of the state of AI, or your thought processes, I wonder.

                Keep Calm and Carry On

                D Offline
                D Offline
                Daniel Pfeffer
                wrote on last edited by
                #22

                Yes. :|

                Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  :laugh: It's not quite that good, but if you do something like this:

                  var bananas = Fruit.GetFruits(Color.Yellow);

                  Then later in the method type foreach(it will autofill with this:

                  foreach(var f in bananas)

                  If (as I much prefer) you use an explicit type:

                  List bananas = Fruit.GetFruits(Color.Yellow);

                  Then the autofill is explicit as well:

                  foreach(Fruit fruit in bananas)

                  All on a single TAB press. Once you are used to it, it takes the typing out of the simple stuff, and it leaves you free to concentrate on the "why" you are doing it, instead of the "what".

                  "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!

                  C Offline
                  C Offline
                  Calin Negru
                  wrote on last edited by
                  #23

                  It comes a bit difficult to think in C# terms but I`ll try How about the situation when you have so many fruits that they won`t fit in a single list. We are talking about a huge amount of fruits, all of the same type. So you would have to use lists of lists or lists of lists of lists.

                  List> lemons = Fruit.GetFruitsLists(Color.Yellow);

                  can autocomplete deal with that? [edit] ok it`s a bit of a wild guess on my behalf, I just don`t know if what I`m saying is correct but if you have a huge number of fruits, all of them rather small in dimension would you keep a single list containing all of them thus resulting a huge solid blob of memory difficult to maneuver, or, second option, partition them into multiple lists which would make a more flexible solution from the memory usage perspective.

                  OriginalGriffO M 4 Replies Last reply
                  0
                  • C Calin Negru

                    It comes a bit difficult to think in C# terms but I`ll try How about the situation when you have so many fruits that they won`t fit in a single list. We are talking about a huge amount of fruits, all of the same type. So you would have to use lists of lists or lists of lists of lists.

                    List> lemons = Fruit.GetFruitsLists(Color.Yellow);

                    can autocomplete deal with that? [edit] ok it`s a bit of a wild guess on my behalf, I just don`t know if what I`m saying is correct but if you have a huge number of fruits, all of them rather small in dimension would you keep a single list containing all of them thus resulting a huge solid blob of memory difficult to maneuver, or, second option, partition them into multiple lists which would make a more flexible solution from the memory usage perspective.

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

                    I would suspect so, but I'm on a tablet at the moment, and don't have VS 2022 installed on it. I'll check tomorrow when I'm back on the desktop.

                    "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
                    • C Calin Negru

                      It comes a bit difficult to think in C# terms but I`ll try How about the situation when you have so many fruits that they won`t fit in a single list. We are talking about a huge amount of fruits, all of the same type. So you would have to use lists of lists or lists of lists of lists.

                      List> lemons = Fruit.GetFruitsLists(Color.Yellow);

                      can autocomplete deal with that? [edit] ok it`s a bit of a wild guess on my behalf, I just don`t know if what I`m saying is correct but if you have a huge number of fruits, all of them rather small in dimension would you keep a single list containing all of them thus resulting a huge solid blob of memory difficult to maneuver, or, second option, partition them into multiple lists which would make a more flexible solution from the memory usage perspective.

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

                      The edited bit ... Whoo, that's a complicated one ... Lists are pretty efficient at what they do, but it depends on what you actually do with them - this may help: List<T> - Is it really as efficient as you probably think?[^] So a List of Lists (of lists) could be more efficient than a monolithic list. Or it could be massively inefficient if you use it badly. But remember that as it's a class the collection(s) are storing, the memory occupied is the same whether it's an instance or a collection that it holds - the memory for the actual instance will be exactly the same size and number regardless, so nested collections may take up slightly more memory than a single one because of the extra references to collections involved. But only if you let the big one grow to size - otherwise the "double each time it's full" part of the equation starts to consume inordinate amounts of memory (and processing time to copy across as it goes). But then when you use it, the flat model outperforms in it terms of processing, because there is less dereferencing going on. And if you start storing the Fruit as a struct rather than a class to save space and dereferencing, you introduce a whole new kettle of fish because the size of the Fruit starts to impact space and processing when you copy it each time (value types) instead of copying the reference alone. And ... there is a limit on the size of the monolithic collection because of the .NET limit on max size of any one item, and an array of structs is a single chunk of memory n * sizeof(Fruit) bytes long instead of n * 4 or n * 8 bytes long for an array / list of references. Again, this might help: Using struct and class - what's that all about?[^] It's never as simple as it seems, is it? :laugh: [edit] Second link changed - I forgot to CTRL+C before pasting ... :-O [/edit]

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it sh

                      "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

                      C 1 Reply Last reply
                      0
                      • C Calin Negru

                        It comes a bit difficult to think in C# terms but I`ll try How about the situation when you have so many fruits that they won`t fit in a single list. We are talking about a huge amount of fruits, all of the same type. So you would have to use lists of lists or lists of lists of lists.

                        List> lemons = Fruit.GetFruitsLists(Color.Yellow);

                        can autocomplete deal with that? [edit] ok it`s a bit of a wild guess on my behalf, I just don`t know if what I`m saying is correct but if you have a huge number of fruits, all of them rather small in dimension would you keep a single list containing all of them thus resulting a huge solid blob of memory difficult to maneuver, or, second option, partition them into multiple lists which would make a more flexible solution from the memory usage perspective.

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

                        Interestingly, if you use var it copes quite well. If you use an explicit type, it doesn't suggest anything. And now, a few minutes later it doesn't cope at all ... but the GetFruits example yesterday does ... VS has just updated itself, that may be the reason. I'll try a shut down and restart of the whole PC to clear out any "old bits" it may still have running later.

                        "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
                        • D dan sh

                          I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

                          // Replace all the commas that are between double quotes
                          char[] linechars = line.ToCharArray();
                          bool isInQuotes = false;

                          for (int i = 0; i < linechars.Length; i++)
                          {
                          if (linechars[i] == '"')//This was predicted by Visual Studio

                          This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                          "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                          M Offline
                          M Offline
                          maze3
                          wrote on last edited by
                          #27

                          im still annoyed with auto double quotes have string need to setup, value from excel for example

                          var myString =

                          go and copy value and paste in

                          var myString = fancyLongvalue_that i dont want to type out

                          now need to wrap in quote

                          var myString = ""fancyLongvalue_that i dont want to type out

                          😒 type one double quote and gives me two, kinda like hidden clippy somewhere "oh you want string, take two" ok, well delete the second, and move to end of line to add closing quote

                          var myString = "fancyLongvalue_that i dont want to type out""

                          😡fancy auto complete but still thinking I want a second quote when already warning with a bunch of error due to first quote

                          M 1 Reply Last reply
                          0
                          • D dan sh

                            I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

                            // Replace all the commas that are between double quotes
                            char[] linechars = line.ToCharArray();
                            bool isInQuotes = false;

                            for (int i = 0; i < linechars.Length; i++)
                            {
                            if (linechars[i] == '"')//This was predicted by Visual Studio

                            This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                            "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                            G Offline
                            G Offline
                            Gary Wheeler
                            wrote on last edited by
                            #28

                            I had to turn off a lot of the "assistance" in VS2019 because it was so visually noisy. Three and four tooltips displayed whenever you moved the cursor or the mouse. Countless icons in the left margin or at the end of each line of code. Grey, unreadable text displayed beneath identifiers. The suggested solutions are based on style and Microsoft conventions, which do not match our local practices. Tailoring the Microsoft settings does not appear to affect their complaints about how you code. Yes, I'm an old bull :elephant: and it's my version of yelling at the kids to "Get off my lawn!".

                            Software Zen: delete this;

                            1 Reply Last reply
                            0
                            • C Calin Negru

                              It comes a bit difficult to think in C# terms but I`ll try How about the situation when you have so many fruits that they won`t fit in a single list. We are talking about a huge amount of fruits, all of the same type. So you would have to use lists of lists or lists of lists of lists.

                              List> lemons = Fruit.GetFruitsLists(Color.Yellow);

                              can autocomplete deal with that? [edit] ok it`s a bit of a wild guess on my behalf, I just don`t know if what I`m saying is correct but if you have a huge number of fruits, all of them rather small in dimension would you keep a single list containing all of them thus resulting a huge solid blob of memory difficult to maneuver, or, second option, partition them into multiple lists which would make a more flexible solution from the memory usage perspective.

                              M Offline
                              M Offline
                              Matt Bond
                              wrote on last edited by
                              #29

                              I've never had so much data that I had to be concerned with splitting my List<> objects. However, I have had a need for List> before because of the nature of the data. Think of the outer list being for all car manufacturers while each inner list is for each car model they make. Because of how my database data was structured, this made more sense at the time. I could have used linq to combine all car lists into a single list, but it wasn't necessary.

                              Bond Keep all things as simple as possible, but no simpler. -said someone, somewhere

                              C 1 Reply Last reply
                              0
                              • Greg UtasG Greg Utas

                                Perhaps you or someone else can explain this {get; set;} thing to me. There are times when having a getter is appropriate, but far fewer times when having a setter is appropriate. I'm surprised that they make it so easy to mindlessly provide one.

                                Robust Services Core | Software Techniques for Lemmings | Articles
                                The fox knows many things, but the hedgehog knows one big thing.

                                M Offline
                                M Offline
                                Matt Bond
                                wrote on last edited by
                                #30

                                Just add "private" in front of "set;". Then you can set the value internally to your class but not from outside the class. The getter would have the same access as the property itself.

                                Bond Keep all things as simple as possible, but no simpler. -said someone, somewhere

                                1 Reply Last reply
                                0
                                • D Dan Neely

                                  Kornfeld Eliyahu Peter wrote:

                                  Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

                                  I had more obviously wrong suggestions than cases where it generated what I wanted, but that's not why I turned it off after a few weeks. I pulled the plug because about 5-10% of the suggestions were dangerously wrong. Things that looked OK at first glance, but which had subtle logic errors in them. Trying to debug my own wrong think is bad enough, when the code running is ever so slightly off of what I intended was far worse.

                                  Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

                                  M Offline
                                  M Offline
                                  Member 110323
                                  wrote on last edited by
                                  #31

                                  I've found that most of the suggestions (80%+) are exactly what I wanted to do. I've been pretty wowed by the technology. Maybe it's because it's looking over my shoulder and learning from a truly great programming master ;-)

                                  1 Reply Last reply
                                  0
                                  • D dan sh

                                    I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

                                    // Replace all the commas that are between double quotes
                                    char[] linechars = line.ToCharArray();
                                    bool isInQuotes = false;

                                    for (int i = 0; i < linechars.Length; i++)
                                    {
                                    if (linechars[i] == '"')//This was predicted by Visual Studio

                                    This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                                    "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                                    S Offline
                                    S Offline
                                    Steve Naidamast
                                    wrote on last edited by
                                    #32

                                    Yes, another convenience that will allow developers to think less...

                                    Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com

                                    1 Reply Last reply
                                    0
                                    • OriginalGriffO OriginalGriff

                                      The edited bit ... Whoo, that's a complicated one ... Lists are pretty efficient at what they do, but it depends on what you actually do with them - this may help: List<T> - Is it really as efficient as you probably think?[^] So a List of Lists (of lists) could be more efficient than a monolithic list. Or it could be massively inefficient if you use it badly. But remember that as it's a class the collection(s) are storing, the memory occupied is the same whether it's an instance or a collection that it holds - the memory for the actual instance will be exactly the same size and number regardless, so nested collections may take up slightly more memory than a single one because of the extra references to collections involved. But only if you let the big one grow to size - otherwise the "double each time it's full" part of the equation starts to consume inordinate amounts of memory (and processing time to copy across as it goes). But then when you use it, the flat model outperforms in it terms of processing, because there is less dereferencing going on. And if you start storing the Fruit as a struct rather than a class to save space and dereferencing, you introduce a whole new kettle of fish because the size of the Fruit starts to impact space and processing when you copy it each time (value types) instead of copying the reference alone. And ... there is a limit on the size of the monolithic collection because of the .NET limit on max size of any one item, and an array of structs is a single chunk of memory n * sizeof(Fruit) bytes long instead of n * 4 or n * 8 bytes long for an array / list of references. Again, this might help: Using struct and class - what's that all about?[^] It's never as simple as it seems, is it? :laugh: [edit] Second link changed - I forgot to CTRL+C before pasting ... :-O [/edit]

                                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it sh

                                      C Offline
                                      C Offline
                                      Calin Negru
                                      wrote on last edited by
                                      #33

                                      Thanks for explaining

                                      Quote:

                                      Second link changed - I forgot to CTRL+C before pasting ...

                                      just noticed your edit. I think public logging of edit time would make a nice CP feature.

                                      OriginalGriffO 1 Reply Last reply
                                      0
                                      • C Calin Negru

                                        Thanks for explaining

                                        Quote:

                                        Second link changed - I forgot to CTRL+C before pasting ...

                                        just noticed your edit. I think public logging of edit time would make a nice CP feature.

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

                                        Calin Cali wrote:

                                        I think public logging of edit time would make a nice CP feature.

                                        You mean like the "modified 20hrs ago." text at the bottom of the message? :laugh:

                                        "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

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

                                          It is amazing... until it is not... Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

                                          “Real stupidity beats artificial intelligence every time.” ― Terry Pratchett, Hogfather

                                          L Offline
                                          L Offline
                                          Lance Milleson
                                          wrote on last edited by
                                          #35

                                          80% of my code is "plain stupid repetition of what [I've] done before"

                                          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