/// <summary> /// Returns a <see cref="String"/> that represents the <see cref="Variable"/> with the /// specified identifier in the specified collection.</summary> /// <param name="variables"> /// The <see cref="VariableList"/> to search.</param> /// <param name="id"> /// The <see cref="Variable.Id"/> string of the <see cref="Variable"/> instance to /// format.</param> /// <returns><para> /// The result of <see cref="Variable.ToString"/> for the <paramref name="variables"/> /// element with the specified <paramref name="id"/>. /// </para><para>-or-</para><para> /// A null reference if no such element is found.</para></returns> private static string FormatVariable(VariableList variables, string id) { int index = variables.IndexOfKey(id); return(index < 0 ? null : variables[index].ToString()); }