public static object ExpandAllForProperty(string propertyName, object property, IReadOnlyDictionary <string, string> varExpansions, Func <string, PropertyDefinition> propertyDefinitionGetter) { PropertyDefinition definition = propertyDefinitionGetter(propertyName); bool didExpand = false; property = varExpansions.Aggregate(property, (current, kvp) => { didExpand |= definition.ExpandVariable(current, kvp.Key, kvp.Value, out object copy); return(copy); }); if (didExpand) { Log.Debug("Expanded all variables in property '{0}' => '{1}'", propertyName, property); } if (definition.StripEscapedVariables(property, out property)) { Log.Debug("Stripped all escaped variables in property '{0}' => '{1}'", propertyName, property); } return(property); }