/// <summary>
/// HTML Decode field of object
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="item"></param>
/// <param name="field"></param>
public static void HtmlDecode<T>(T item, string field)
{
Type type;
PropertyInfo fieldPropertyInfo;
type = item.GetType();
fieldPropertyInfo = type.GetProperty(field);
if (fieldPropertyInfo.PropertyType == typeof(string))
fieldPropertyInfo.SetValue(item, HttpUtility.HtmlDecode(Convert.ToString(fieldPropertyInfo.GetValue(item, null))), null);
}
/// HTML Decode field of object
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="item"></param>
/// <param name="field"></param>
public static void HtmlDecode<T>(T item, string field)
{
Type type;
PropertyInfo fieldPropertyInfo;
type = item.GetType();
fieldPropertyInfo = type.GetProperty(field);
if (fieldPropertyInfo.PropertyType == typeof(string))
fieldPropertyInfo.SetValue(item, HttpUtility.HtmlDecode(Convert.ToString(fieldPropertyInfo.GetValue(item, null))), null);
}
No comments:
Post a Comment