private static void ReadTreeNode(SerializedFileReader reader, ICollection <TypeTreeNode> nodes, byte depth) { TypeTreeNode node = new TypeTreeNode(depth); node.Read(reader); nodes.Add(node); int childCount = reader.ReadInt32(); for (int i = 0; i < childCount; i++) { ReadTreeNode(reader, nodes, (byte)(depth + 1)); } }