title: BinaryFormatter and Deserialization Complex objects
body: <p>Can not deserialize following object graph. That Exception occurs when deserialize method called on BinaryFormmater:
  System.Runtime.Serialization.SerializationException : </p>
  
  <pre><code>The constructor to deserialize an object of type 'C' was not found.
  </code></pre>
  
  <p>There're two constructor on C. and I think the problem may be : While serialization Binaryformatter using the paramatered one and on deserialization process, it needs a parameterless one. Is there a hack / solution?
  Objects :</p>
  
  <pre><code>  [Serializable]
      public class A
      {
          B b;
          C c;
  
          public int ID { get; set; }
  
          public A()
          {
          }
  
          public A(B b)
          {
              this.b = b;
          }
  
          public A(C c)
          {
              this.c = c;
          }
      }
      [Serializable]
      public class B
      {
  
      }
      [Serializable]
      public class C : Dictionary&lt;int, A&gt;
      {
          public C()
          {
  
          }
  
          public C(List&lt;A&gt; list)
          {
              list.ForEach(p =&gt; this.Add(p.ID, p));
          }
      }
  </code></pre>
  
  <p>// Serialization success</p>
  
  <pre><code>    byte[] result;
      using (var stream =new MemoryStream())
      {
          new BinaryFormatter ().Serialize (stream, source);
          stream.Flush ();
          result = stream.ToArray ();
      }
      return result;
  </code></pre>
  
  <p>// Deserialization fails</p>
  
  <pre><code>    object result = null;
      using (var stream = new MemoryStream(buffer))
      {
          result = new BinaryFormatter ().Deserialize (stream);
      }
      return result;
  </code></pre>
  
  <p>The calls are at the same environment, same thread, same method</p>
  
  <pre><code>        List&lt;A&gt; alist = new List&lt;A&gt;()
          {
              new A {ID = 1},
              new A {ID = 2}
          };
  
          C c = new C(alist);
          var fetched = Serialize (c); // success
          var obj = Deserialize(fetched); // failes
  </code></pre>