title: Reading varying sized string from serial port
body: <p>I am reading in a string in C# from an arduino over serial communication. I was using <code>ReadLine()</code> to set a string to the incoming data. However, I noticed that <code>ReadLine()</code> slows down my data reception and when using a console I can see that a delay begins to develop between receiving the data and outputting it.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is there a fast way to read in one line from serial to a string when the size of the string is variable? I need to be able to process the string and it is important that I don't lose data between reads. My data comes in using the format <code>&lt;ID,Name,Data&gt;</code> and each of these are on their own line. Is there any way I could just read between <code>&lt;</code> and <code>&gt;</code>?</p>
  
  <p><strong>Current Code</strong></p>
  
  <pre><code>private void Form1_Shown(object sender, EventArgs e)
      {
              serialPort1 = new SerialPort(comboPorts.SelectedItem.ToString(), 115200);
              serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceived);
              serialPort1.Open();
      }
  
      private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
      { 
          string inData = serialPort1.ReadLine();
          Console.WriteLine(inData);
  </code></pre>
  
  <p>}</p>