Added comments and made ReplaceVariables(string, Dictionary`2) into an extension method
This commit is contained in:
parent
2fdb51569e
commit
cdef17b5ab
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user