title: Deserialization and null references best practice - set to null or ignore?
body: <p>This is a question about serialization in general, but in particular I am using <a href="http://www.servicestack.net/docs/text-serializers/json-csv-jsv-serializers" rel="nofollow">ServiceStack's excellent serializers</a> in my .NET code. </p>
  
  <p>Should the deserializers set null references on properties? It seems like currently it ignores null references and just allows such fields to be set according the class's defaults. For example, this test fails:</p>
  
  <pre><code>[TestMethod]
  public void Deserialize_WithNullCollection_CollectionIsNull() {
      var serializer = new ServiceStack.Text.TypeSerializer&lt;Foo&gt;();
      Foo item = new Foo() { Strings = null };
      Foo result = serializer.DeserializeFromString(serializer.SerializeToString(item));
      Assert.IsNull(result.Strings);
  }
  public class Foo {
      public Foo() {
          Strings = new List&lt;string&gt;();
      }
      public List&lt;string&gt; Strings { get; set; }
  }
  </code></pre>
  
  <p>I believe this perhaps this test ought to succeed, but it does not--item.Foo is an empty list rather than a null reference. It seems to me that null references are part of an object's state just like any actual reference is. Am I right or wrong?</p>