title: How to serialize a List in VB?
body: <p>I am writing a program to take several fields of a "patient" and serialize the data into XML. I am grabbing all the information as follows:</p>
  
  <pre><code>Dim pacients As New List(Of Patients)
  Dim p As New Patients
  p.mFirstName = txtFirstName.ToString
  p.mlastName = txtLastName.ToString
  p.mInsurance = txtInsurance.ToString
  p.mDOB = txtDateOfBirth.ToString
  p.mEmail = txtEmail.ToString
  p.mPhone = txtPhone.ToString
  p.mPlanID = txtPhone.ToString
  p.mSubID = txtSubID.ToString  
  </code></pre>
  
  <p>And this is the part with the big error (this is triggered by a different 'save all' button, where as the code before is part of a 'add to list' button):</p>
  
  <pre><code>Dim writer As New StreamWriter(PatientFileName.PatientFileName)
  Dim serial As New XmlSerializer(GetType(Patients))
  serial.Serialize(writer, pacients) 'in this line it just says there was an error generating the xml document
  writer.Close()
  </code></pre>
  
  <p>If the patients class is required I will post it.</p>