private static string GetVariableReplaceText(string html, string[] propertyVariables, object objectToTemplate) { Type objectType = objectToTemplate.GetType(); foreach (string propertyVariable in propertyVariables) { BoxVariable variable = new BoxVariable(propertyVariable, objectToTemplate); //PropertyInfo prop = objectType.GetProperty(propertyVariable.Replace(VariablePrefix, "").Replace(VariableSuffix, "")); //object value = prop.GetValue(objectToTemplate, null); //string stringValue = value == null ? "": value.ToString(); if (html.Contains(propertyVariable)) { html = html.Replace(propertyVariable, variable.Value); } } return(html); }
private static string GetVariableReplaceText(string html, string[] propertyVariables, object objectToTemplate) { Type objectType = objectToTemplate.GetType(); foreach (string propertyVariable in propertyVariables) { BoxVariable variable = new BoxVariable(propertyVariable, objectToTemplate); //PropertyInfo prop = objectType.GetProperty(propertyVariable.Replace(VariablePrefix, "").Replace(VariableSuffix, "")); //object value = prop.GetValue(objectToTemplate, null); //string stringValue = value == null ? "": value.ToString(); if (html.Contains(propertyVariable)) html = html.Replace(propertyVariable, variable.Value); } return html; }
public static string[] GetPropertyVariables(Type typeToGetVariablesFor) { return(BoxVariable.GetPropertyVariables(typeToGetVariablesFor)); }