title: Need to access a serial port from different classes
body: <p>I am using a serial port object that was generated by the designer in C# (non static).</p>
  
  <p>I need to be able to access it from methods that are static in different classes (I know it is a bad practice but that is what I inherit)</p>
  
  <p>The port access use the below code.</p>
  
  <pre><code>    public bool Read_Board_Port()
      {
          byte[] bData = new byte[256];
          string message;
          bool sucess = false;
          try
          {
              if (!(serialBoardPort.IsOpen == true))
                  Connect_To_Board(Globals.BoardportName, Globals.BoardbaudRate, Globals.Boardparity, Globals.BoardstopBits, Globals.BoarddataBits);
  
             if(CMDDirect || Globals.HostCommandString)
              {
                  serialBoardPort.ReadTimeout = 1000; // Timeout if no answer from the port.
                  message = serialBoardPort.ReadLine();
                  Globals.RXBoardBuff = Encoding.UTF8.GetBytes(message);
                  Write_To_Console_Dr(message);
                  sucess = true;
              }
             else
              {
                  serialBoardPort.Read(Globals.RXBoardBuff, 0, Constants.RXBOARDBUFFSIZE);
                  if (Check_Command_Correct(Globals.RXBoardBuff, Globals.CommandOut))
                      sucess = true;
                  else
                  {
                      Write_Error_To_Console_Dr(Constants.ERRORDATAFROMBOARDPORT);
                      sucess = false;
                  }
              }
          }
          catch
          {
              MessageBox.Show(Constants.ERRORNODATABOARPORT);
              sucess = false;
          }
  
          return sucess;
      }
  </code></pre>
  
  <p>If I declare <strong><em>new</em></strong> a different instance of the serial port will be used, I need to use the port that is already open.</p>
  
  <p>Thanks</p>