title: Problems with BinaryFormatter on class with DataContract?
body: <p>I have a class</p>
  
  <pre><code>[DataContract]
      public class Car
     {
          public bool pbIsHatchBack;
          string prSt = "royi";
  
      }
  </code></pre>
  
  <p>And i want to serialize it with <strong>BinaryFormatter</strong>:</p>
  
  <pre><code>  BinaryFormatter binFormat = new BinaryFormatter();
          Stream fStream = new FileStream("c:\\CarData.dat", FileMode.Create, FileAccess.Write, FileShare.None);
          binFormat.Serialize(fStream, carObj);
          fStream.Close();
  </code></pre>
  
  <p>But u get this error</p>
  
  <blockquote>
    <p>Type 'SerializationTypes+Car' in Assembly 'ConsoleApplication2,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked
    as serializable.</p>
  </blockquote>
  
  <p>If i remove the [<strong>DataContract</strong>] and replace it with [<strong>Serializable</strong>] its <strong>ok</strong>. but <strong>why</strong> ?</p>
  
  <p>how WCF does it behind the scene (when tcpBinding ?)? </p>
  
  <p>Why <strong>can't</strong> i use the DataContract ???</p>