title: Serialization in C# without using file system
body: <p>I have a simple 2D array of strings and I would like to stuff it into an SPFieldMultiLineText in MOSS.  This maps to an ntext database field.</p>
  
  <p>I know I can serialize to XML and store to the file system, but I would like to serialize without touching the filesystem.</p>
  
  <pre><code>public override void ItemAdding(SPItemEventProperties properties)
  {
      // build the array
      List&lt;List&lt;string&gt;&gt; matrix = new List&lt;List&lt;string&gt;&gt;();
      /*
      * populating the array is snipped, works fine
      */
      // now stick this matrix into the field in my list item
      properties.AfterProperties["myNoteField"] = matrix; // throws an error
  }
  </code></pre>
  
  <p>Looks like I should be able to do something like this:</p>
  
  <pre><code>XmlSerializer s = new XmlSerializer(typeof(List&lt;List&lt;string&gt;&gt;));
  properties.AfterProperties["myNoteField"] = s.Serialize.ToString();
  </code></pre>
  
  <p>but that doesn't work.  All the examples I've found demonstrate writing to a text file.</p>