Example #1
0
 public static TreeWriter <T> Serialize <T>(this Tree <T> tree, TreeWriter <T> serializer)
 {
     serializer.WritePrefix(tree);
     if (!tree.IsLeaf)
     {
         for (int i = 0; i < tree.Branches.Count; i++)
         {
             serializer.WriteBranch(tree.Branches[i], i);
         }
     }
     serializer.WriteSuffix(tree);
     return(serializer);
 }
Example #2
0
 public TreeWriter <T> Serialize(TreeWriter <T> serializer)
 {
     serializer.WritePrefix(this);
     if (!IsLeaf)
     {
         for (int i = 0; i < Branches.Count; i++)
         {
             serializer.WriteBranch(Branches[i], i);
         }
     }
     serializer.WriteSuffix(this);
     return(serializer);
 }