/// <summary> /// Reads from the stream up to the specified delimiter character. /// </summary> /// <param name="delimiter">The character that signals the end of the string.</param> /// <returns>A string formed from characters up to the first instance of the specified delimeter.</returns> protected string ReadString(BinaryMemoryReader reader, char delimiter) { StringBuilder sb = new StringBuilder(); char c; // sift through each character until we hit the delimiter while ((c = reader.ReadChar()) != delimiter) { sb.Append(c); } // return the accumulated string return(sb.ToString()); }