/// <summary> /// Simple DFS to convert the CodeNode tree to the flat linked list of bytes /// </summary> /// <param name="cn"></param> /// <returns></returns> private LinkedList <byte> CollectBytes(CodeNode cn) { if (cn.IsLeaf()) { return(cn.Bytes); } LinkedList <byte> toReturn = new LinkedList <byte>(); foreach (CodeNode child in cn.Children) { foreach (byte b in CollectBytes(child)) { toReturn.AddLast(b); } } return(toReturn); }