title: Serializing references to other serialized objects
body: <p>I have two serializable Classes:</p>
  
  <pre><code>[Serializable]
  public class Word
  {
      public List&lt;string&gt; similes;
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>[Serializable]
  public class Lexicon
  {
      public List&lt;Word&gt; words;
  }
  </code></pre>
  
  <p>both classes are stored as XML files separately, however the XML files for Lexicon comes out like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Word&gt;
      &lt;Similes&gt;
          &lt;string&gt;Hello&lt;/string&gt;
          &lt;string&gt;Hi&lt;/string&gt;
      &lt;/Similes&gt;
  &lt;/Word&gt;
  
  &lt;Word&gt;
      &lt;Similes&gt;
          &lt;string&gt;Goodbye&lt;/string&gt;
          &lt;string&gt;Bye&lt;/string&gt;
      &lt;/Similes&gt;
  &lt;/Word&gt;
  
  &lt;Lexicon&gt;
      &lt;Words&gt;
          &lt;Word&gt;
              &lt;Similes&gt;
                  &lt;string&gt;Hello&lt;/string&gt;
                  &lt;string&gt;Hi&lt;/string&gt;
              &lt;/Similes&gt;
          &lt;/Word&gt;
          &lt;Word&gt;
              &lt;Similes&gt;
                  &lt;string&gt;Goodbye&lt;/string&gt;
                  &lt;string&gt;Bye&lt;/string&gt;
              &lt;/Similes&gt;
          &lt;/Word&gt;
      &lt;/Words&gt;
  &lt;/Lexicon&gt;
  </code></pre>
  
  <p>And that's just with two words! You can see how this would quickly get out of hand  as more Words were added, additionally the "Hello, Hi" Word, when deserialized, is a different object to the one stored inside the deserialized Lexicon - when they should reference the same object.</p>
  
  <p>So essentially <strong>is there a way to make the serialized Lexicon file reference the files produced by serializing the Word instances instead of duplicating the xml?</strong></p>