From f92f21ab7284bae97de4fe81cd02b46de8c36d22 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 1 Oct 2019 21:44:36 +0100 Subject: [PATCH] Code inspections --- Meade.net.Telescope/Telescope.cs | 2 +- Meade.net/SetupDialogForm.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index a048066..553ac24 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -576,7 +576,7 @@ namespace ASCOM.Meade.net { CheckConnectedAndValidateSite(site, "SetSiteName"); - string command = String.Empty; + string command; switch (site) { case 1: diff --git a/Meade.net/SetupDialogForm.cs b/Meade.net/SetupDialogForm.cs index 4067b83..2c46665 100644 --- a/Meade.net/SetupDialogForm.cs +++ b/Meade.net/SetupDialogForm.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO.Ports; +using System.Linq; using System.Runtime.InteropServices; using System.Windows.Forms; using ASCOM.Meade.net.Properties; @@ -54,8 +55,9 @@ namespace ASCOM.Meade.net chkTrace.Checked = profileProperties.TraceLogger; // set the list of com ports to those that are currently available comboBoxComPort.Items.Clear(); - comboBoxComPort.Items.AddRange(SerialPort - .GetPortNames()); // use System.IO because it's static + var portNames = SerialPort.GetPortNames().ToArray(); + + comboBoxComPort.Items.AddRange(portNames); // use System.IO because it's static // select the current port if possible if (comboBoxComPort.Items.Contains(profileProperties.ComPort)) {