Added comments and made ReplaceVariables(string, Dictionary`2) into an extension method

This commit is contained in:
Michael Becker 2014-12-01 15:44:25 -05:00
parent 2fdb51569e
commit cdef17b5ab

View File

@ -5,7 +5,16 @@ namespace UniversalEditor.Common
{
public static class Strings
{
public static string ReplaceVariables(string value, Dictionary<string, object> variables)
/// <summary>
/// Replaces a collection of named variables in a given string.
/// </summary>
/// <param name="value">The string in which to replace variables.</param>
/// <param name="variables">A <see cref="T:Dictionary`2" /> containing name-value pairs of variables to replace.</param>
/// <returns>
/// A <see cref="String" /> with all instances of variables with the given name in $(VariableName) replaced
/// with the associated value.
/// </returns>
public static string ReplaceVariables(this string value, Dictionary<string, object> variables)
{
string retval = value;
foreach (string key in variables.Keys)