title: VB.NET serializing array variables
body: <p>I'm building a Windows Forms Application on vb.net and I'd like to make use of "save" and "open" options for the end user.
  What I want to achieve is serialization (binary or XML) upon Save As click event of the current values of some specific variables (mainly arrays), which are declared inside the Form Class, and then deserialization of them upon Open click event.</p>
  
  <p>These events occur inside the Form Class.</p>
  
  <p>This is how my code looks like (trying to serialize "testvar" string array)</p>
  
  <pre><code>Imports System.IO
  Imports System.Xml.Serialization
  Imports System.Globalization        
  
  &lt;Serializable()&gt; Public Class app
  
      Dim testvar(100,100) as string
  
      ...
      ...(methods)
      ...
  
      Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
  
  
          Dim ser As XmlSerializer = New XmlSerializer(GetType(String()))
          Using fs As New IO.StreamWriter("E:\test.xml")
              ser.Serialize(fs, testvar)                 '-&gt;ERROR "InvalidOperationException was unhandled
          End Using
  
      End Sub
  
  End Class
  </code></pre>
  
  <p>What am I doing wrong?
  Excuse my ignorance, I am new to serialization.
  I would be grateful for any help.</p>