c# ref keyword... Am i passing my value correctly?

Posted by Pandiya Chendur on Stack Overflow See other posts from Stack Overflow or by Pandiya Chendur
Published on 2010-06-14T05:36:01Z Indexed on 2010/06/14 5:42 UTC
Read the original article Hit count: 289

Filed under:
|
|

Is this a valid value for this c# class default constructor,

public class SMSCOMMS
{
   public SMSCOMMS(ref string COMMPORT)
   {
    SMSPort = new SerialPort();
    SMSPort.PortName = COMMPORT;
    SMSPort.BaudRate = 9600;
    SMSPort.Parity = Parity.None;
    SMSPort.DataBits = 8;
    SMSPort.StopBits = StopBits.One;
    SMSPort.Handshake = Handshake.RequestToSend;
    SMSPort.DtrEnable = true;
    SMSPort.RtsEnable = true;
    SMSPort.NewLine = System.Environment.NewLine;
    ReadThread = new Thread(
        new System.Threading.ThreadStart(ReadPort));
}

and i am passing this value,

SMSCOMMS SMSEngine = new SMSCOMMS("COM6"); but it doesn't seem to take "COM6" as a valid ref string... Any suggestion..

© Stack Overflow or respective owner

Related posts about c#

Related posts about keyword