Exemplo n.º 1
0
        /// <summary>
        /// Converts the subset of procedure descriptions identified by the input procedure names
        /// to their string representations. A procedure name is matched if that name contains an
        /// input string as a substring.
        /// </summary>
        /// <param name="proceduresToPrint">Names which identify the subset of procedure
        /// descriptions to print; all procedures are printed if this is null.</param>
        /// <returns>
        /// A <see cref="string" /> that represents this instance.
        /// </returns>
        public string ToString(IEnumerable <string> proceduresToPrint)
        {
            IEnumerable <KeyValuePair <string, ProcedureDescription> > procsToPrint;

            if (proceduresToPrint != null)
            {
                procsToPrint = Procs.Where(kv => proceduresToPrint.Any(pn => kv.Key.Contains(pn)));
            }
            else
            {
                procsToPrint = Procs;
            }

            var procStrings = procsToPrint.Select(
                kv => $"{kv.Key}\n===============\n{kv.Value.ToString()}");

            return(string.Join("\n\n\n", procStrings));
        }