/// <summary>
        /// Searches the entire sorted list of lines for a specified line and returns
        /// zero-based index of the line.
        /// </summary>
        /// <param name="line">The line to locate.</param>
        /// <returns>
        /// The zero-based index of a line int sorted list, if item is found; otherwise,
        /// a negative number that is the bitwise complement of the index of the next
        /// line that is larger than a line or, if there is no larger line, the bitwise
        /// complement of the count of <see cref="Lines"/>.
        /// </returns>
        public int BinarySearch(Line line)
        {
            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }

            if (string.IsNullOrEmpty(line.Label))
            {
                throw new ArgumentException(ErrorMessages.EmptyLabel, nameof(line));
            }

            return(Lines.BinarySearch(line));
        }
        /// <summary>
        /// Adds the specified line to the program, or updates existing line, if it has the same label.
        /// </summary>
        /// <param name="line">The program line.</param>
        public void AddOrUpdate(Line line)
        {
            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }

            if (string.IsNullOrEmpty(line.Label))
            {
                throw new ArgumentException(ErrorMessages.EmptyLabel, nameof(line));
            }

            var index = Lines.BinarySearch(line);

            if (index < 0)
            {
                Lines.Insert(~index, line);
            }
            else
            {
                Lines[index] = line;
            }
        }