title: How to Binary Serializer Custom Class
body: <p>I've this custom class:</p>
  
  <pre><code>public class MyClass
  { 
      private byte byteValue;
      private int intValue;
      private MyClass myClass1= null;
      private MyClass myClass2 = null;
  }
  </code></pre>
  
  <p>obviously I also have constructor and get/set methods.</p>
  
  <p>In my main form I initialize a lot of <code>MyClass</code> object (note that in <code>MyClass</code> object I have reference to other 2 MyClass objects). After initialization I iterate through a first <code>MyClass</code> item, call it for instance "root". So, for example I do something like:</p>
  
  <pre><code>MyClass myClassTest = root.getMyClass1();
  MyClass myClassTest2 = myClassTest.getMyClass1();
  </code></pre>
  
  <p>and so on.</p>
  
  <p>No I want to store in a binary file, all the <code>MyClass</code> object instantiated, in order to get them again after software restart.</p>
  
  <p>I have totally no idea on how to do this, can someone please help me?
  Thanks.</p>