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. Make your damn mind up Visual Studio!

Make your damn mind up Visual Studio!

Scheduled Pinned Locked Moved The Lounge
questioncsharpcssvisual-studiobeta-testing
17 Posts 9 Posters 1 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.
  • OriginalGriffO OriginalGriff

    OK, VS2019 is installed, and I loaded a small test project into it - the one I use for checking code before I answer a QA question, as it happens. And the first thing I notice (once I've got all the windows where they belong, and found where to turn off the line numbers anyway) is that it "suggests" changes: using an expression bodied constructor instead of the older style:

    public frmMain()
    {
    InitializeComponent();
    }

    IS out, and this is in:

    public frmMain() => InitializeComponent();

    Hmmm ... OK, I can learn to live with that. Then: "Replace GetWindowsInstallationDateTime with a property":

        public static DateTime GetWindowsInstallationDateTime()
            {
            Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
            key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
            if (key != null)
                {
                DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                DateTime installDate = startDate.AddSeconds(regVal);
                return installDate;
                }
    
            return DateTime.MinValue;
            }
    

    Is out, this is in:

        public static DateTime WindowsInstallationDateTime
            {
            get
                {
                Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                if (key != null)
                    {
                    DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                    Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                    DateTime installDate = startDate.AddSeconds(regVal);
                    return installDate;
                    }
    
                return DateTime.MinValue;
                }
            }
    

    Hmmm. Less sure about this, but I can see why. Kinda. OK. Do it. What's next? Oh, right: "Replace WindowsInstallationDateTime with a method". Hang on a moment ... you want to replace

        public static DateTime WindowsInstallationDateTime
            {
            get
    
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu Peter
    wrote on last edited by
    #4

    AI at it's greatest!!!

    "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018

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

    M L 2 Replies Last reply
    0
    • OriginalGriffO OriginalGriff

      Depends: if the first one is rubbish, then no. If the first one is good, I'll probably try the second. But this is more like the waiter recommending you ignore the menu and go from the specials board, then when he comes back to take the order telling you the specials aren't as good as the regular menu ... :laugh:

      Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

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

      OriginalGriff wrote:

      But this is more like the waiter recommending you ignore the menu and go from the specials board, then when he comes back to take the order telling you the specials aren't as good as the regular menu ... :laugh:

      If you accept each suggestion, than you will be eathing the special, and after finishing and adding it to the total, you'll be suggested to eat from the regular menu. Just like there's tools to "extract" a variable to a property, and back.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "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
      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

        AI at it's greatest!!!

        "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018

        M Offline
        M Offline
        Minion no 5
        wrote on last edited by
        #6

        AS at it's greatest.

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          OK, VS2019 is installed, and I loaded a small test project into it - the one I use for checking code before I answer a QA question, as it happens. And the first thing I notice (once I've got all the windows where they belong, and found where to turn off the line numbers anyway) is that it "suggests" changes: using an expression bodied constructor instead of the older style:

          public frmMain()
          {
          InitializeComponent();
          }

          IS out, and this is in:

          public frmMain() => InitializeComponent();

          Hmmm ... OK, I can learn to live with that. Then: "Replace GetWindowsInstallationDateTime with a property":

              public static DateTime GetWindowsInstallationDateTime()
                  {
                  Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                  key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                  if (key != null)
                      {
                      DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                      Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                      DateTime installDate = startDate.AddSeconds(regVal);
                      return installDate;
                      }
          
                  return DateTime.MinValue;
                  }
          

          Is out, this is in:

              public static DateTime WindowsInstallationDateTime
                  {
                  get
                      {
                      Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                      key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                      if (key != null)
                          {
                          DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                          Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                          DateTime installDate = startDate.AddSeconds(regVal);
                          return installDate;
                          }
          
                      return DateTime.MinValue;
                      }
                  }
          

          Hmmm. Less sure about this, but I can see why. Kinda. OK. Do it. What's next? Oh, right: "Replace WindowsInstallationDateTime with a method". Hang on a moment ... you want to replace

              public static DateTime WindowsInstallationDateTime
                  {
                  get
          
          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #7

          Microsoft, putting the artificial in intelligence.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
          Dave Kreskowiak

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            OK, VS2019 is installed, and I loaded a small test project into it - the one I use for checking code before I answer a QA question, as it happens. And the first thing I notice (once I've got all the windows where they belong, and found where to turn off the line numbers anyway) is that it "suggests" changes: using an expression bodied constructor instead of the older style:

            public frmMain()
            {
            InitializeComponent();
            }

            IS out, and this is in:

            public frmMain() => InitializeComponent();

            Hmmm ... OK, I can learn to live with that. Then: "Replace GetWindowsInstallationDateTime with a property":

                public static DateTime GetWindowsInstallationDateTime()
                    {
                    Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                    key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                    if (key != null)
                        {
                        DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                        Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                        DateTime installDate = startDate.AddSeconds(regVal);
                        return installDate;
                        }
            
                    return DateTime.MinValue;
                    }
            

            Is out, this is in:

                public static DateTime WindowsInstallationDateTime
                    {
                    get
                        {
                        Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                        key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                        if (key != null)
                            {
                            DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                            Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                            DateTime installDate = startDate.AddSeconds(regVal);
                            return installDate;
                            }
            
                        return DateTime.MinValue;
                        }
                    }
            

            Hmmm. Less sure about this, but I can see why. Kinda. OK. Do it. What's next? Oh, right: "Replace WindowsInstallationDateTime with a method". Hang on a moment ... you want to replace

                public static DateTime WindowsInstallationDateTime
                    {
                    get
            
            P Offline
            P Offline
            phil o
            wrote on last edited by
            #8

            recursive adj. See 'recursive'.

            noop()

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

              AI at it's greatest!!!

              "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018

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

              I think it is simply infinite recursion at its best :-D

              It does not solve my Problem, but it answers my question

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                OK, VS2019 is installed, and I loaded a small test project into it - the one I use for checking code before I answer a QA question, as it happens. And the first thing I notice (once I've got all the windows where they belong, and found where to turn off the line numbers anyway) is that it "suggests" changes: using an expression bodied constructor instead of the older style:

                public frmMain()
                {
                InitializeComponent();
                }

                IS out, and this is in:

                public frmMain() => InitializeComponent();

                Hmmm ... OK, I can learn to live with that. Then: "Replace GetWindowsInstallationDateTime with a property":

                    public static DateTime GetWindowsInstallationDateTime()
                        {
                        Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                        key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                        if (key != null)
                            {
                            DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                            Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                            DateTime installDate = startDate.AddSeconds(regVal);
                            return installDate;
                            }
                
                        return DateTime.MinValue;
                        }
                

                Is out, this is in:

                    public static DateTime WindowsInstallationDateTime
                        {
                        get
                            {
                            Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                            key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                            if (key != null)
                                {
                                DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                                DateTime installDate = startDate.AddSeconds(regVal);
                                return installDate;
                                }
                
                            return DateTime.MinValue;
                            }
                        }
                

                Hmmm. Less sure about this, but I can see why. Kinda. OK. Do it. What's next? Oh, right: "Replace WindowsInstallationDateTime with a method". Hang on a moment ... you want to replace

                    public static DateTime WindowsInstallationDateTime
                        {
                        get
                
                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #10

                Visual Studio doesn’t tell you what to do: it offers suggestions. “Would you like to shoot yourself in the foot or hang yourself with too much rope” It just likes to feel helpful in these big life altering decisions.

                cheers Chris Maunder

                L 1 Reply Last reply
                0
                • C Chris Maunder

                  Visual Studio doesn’t tell you what to do: it offers suggestions. “Would you like to shoot yourself in the foot or hang yourself with too much rope” It just likes to feel helpful in these big life altering decisions.

                  cheers Chris Maunder

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

                  Chris Maunder wrote:

                  Visual Studio doesn’t tell you what to do: it offers suggestions. “Would you like to shoot yourself in the foot or hang yourself with too much rope” It just likes to feel helpful in these big life altering decisions.

                  SO if I'm reading this correctly, you're saying that Visual Studio is the new Clippy.

                  Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                  C R 2 Replies Last reply
                  0
                  • L Lost User

                    Chris Maunder wrote:

                    Visual Studio doesn’t tell you what to do: it offers suggestions. “Would you like to shoot yourself in the foot or hang yourself with too much rope” It just likes to feel helpful in these big life altering decisions.

                    SO if I'm reading this correctly, you're saying that Visual Studio is the new Clippy.

                    Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                    C Offline
                    C Offline
                    Chris Maunder
                    wrote on last edited by
                    #12

                    :thumbsup: I may have a brief couple of hours lay-over in Sydney next month. You around?

                    cheers Chris Maunder

                    L 1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      OK, VS2019 is installed, and I loaded a small test project into it - the one I use for checking code before I answer a QA question, as it happens. And the first thing I notice (once I've got all the windows where they belong, and found where to turn off the line numbers anyway) is that it "suggests" changes: using an expression bodied constructor instead of the older style:

                      public frmMain()
                      {
                      InitializeComponent();
                      }

                      IS out, and this is in:

                      public frmMain() => InitializeComponent();

                      Hmmm ... OK, I can learn to live with that. Then: "Replace GetWindowsInstallationDateTime with a property":

                          public static DateTime GetWindowsInstallationDateTime()
                              {
                              Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                              key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                              if (key != null)
                                  {
                                  DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                  Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                                  DateTime installDate = startDate.AddSeconds(regVal);
                                  return installDate;
                                  }
                      
                              return DateTime.MinValue;
                              }
                      

                      Is out, this is in:

                          public static DateTime WindowsInstallationDateTime
                              {
                              get
                                  {
                                  Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                                  key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                                  if (key != null)
                                      {
                                      DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                      Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                                      DateTime installDate = startDate.AddSeconds(regVal);
                                      return installDate;
                                      }
                      
                                  return DateTime.MinValue;
                                  }
                              }
                      

                      Hmmm. Less sure about this, but I can see why. Kinda. OK. Do it. What's next? Oh, right: "Replace WindowsInstallationDateTime with a method". Hang on a moment ... you want to replace

                          public static DateTime WindowsInstallationDateTime
                              {
                              get
                      
                      R Offline
                      R Offline
                      Ravi Bhavnani
                      wrote on last edited by
                      #13

                      Admittedly off-topic, but wouldn't you want to cache the value (if any) read from the registry? /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      OriginalGriffO 1 Reply Last reply
                      0
                      • L Lost User

                        Chris Maunder wrote:

                        Visual Studio doesn’t tell you what to do: it offers suggestions. “Would you like to shoot yourself in the foot or hang yourself with too much rope” It just likes to feel helpful in these big life altering decisions.

                        SO if I'm reading this correctly, you're saying that Visual Studio is the new Clippy.

                        Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                        R Offline
                        R Offline
                        Ravi Bhavnani
                        wrote on last edited by
                        #14

                        VS2019 has AI in its intellisense.  No, really.  (See the VS2019 keynote.) /ravi

                        My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                        1 Reply Last reply
                        0
                        • C Chris Maunder

                          :thumbsup: I may have a brief couple of hours lay-over in Sydney next month. You around?

                          cheers Chris Maunder

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

                          Chris Maunder wrote:

                          I may have a brief couple of hours lay-over in Sydney next month. You around?

                          Now just so you understand, I have read this as I only have a couple of hours to drink sometime next month. You set the pace and I will try and keep up. So yes, I am around.

                          Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                          1 Reply Last reply
                          0
                          • R Ravi Bhavnani

                            Admittedly off-topic, but wouldn't you want to cache the value (if any) read from the registry? /ravi

                            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

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

                            For anything other than "when was Windows installed?" probably yes - but how many times does an app need to know that? :laugh: It was a response to a very specific question!

                            Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... 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
                            • OriginalGriffO OriginalGriff

                              OK, VS2019 is installed, and I loaded a small test project into it - the one I use for checking code before I answer a QA question, as it happens. And the first thing I notice (once I've got all the windows where they belong, and found where to turn off the line numbers anyway) is that it "suggests" changes: using an expression bodied constructor instead of the older style:

                              public frmMain()
                              {
                              InitializeComponent();
                              }

                              IS out, and this is in:

                              public frmMain() => InitializeComponent();

                              Hmmm ... OK, I can learn to live with that. Then: "Replace GetWindowsInstallationDateTime with a property":

                                  public static DateTime GetWindowsInstallationDateTime()
                                      {
                                      Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                                      key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                                      if (key != null)
                                          {
                                          DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                          Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                                          DateTime installDate = startDate.AddSeconds(regVal);
                                          return installDate;
                                          }
                              
                                      return DateTime.MinValue;
                                      }
                              

                              Is out, this is in:

                                  public static DateTime WindowsInstallationDateTime
                                      {
                                      get
                                          {
                                          Microsoft.Win32.RegistryKey key = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64);
                                          key = key.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false);
                                          if (key != null)
                                              {
                                              DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                              Int64 regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString());
                                              DateTime installDate = startDate.AddSeconds(regVal);
                                              return installDate;
                                              }
                              
                                          return DateTime.MinValue;
                                          }
                                      }
                              

                              Hmmm. Less sure about this, but I can see why. Kinda. OK. Do it. What's next? Oh, right: "Replace WindowsInstallationDateTime with a method". Hang on a moment ... you want to replace

                                  public static DateTime WindowsInstallationDateTime
                                      {
                                      get
                              
                              CPalliniC Offline
                              CPalliniC Offline
                              CPallini
                              wrote on last edited by
                              #17

                              I'm used to that. I am married.

                              In testa che avete, signor di Ceprano?

                              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