public string GetHtmlString() { HtmlAsAttribute attribute = (HtmlAsAttribute)p.GetCustomAttribute(typeof(HtmlAsAttribute)); if (attribute != null) { return(attribute.htmlRef); } return(null); }
/// <summary> /// Checks the cache (htmlsAsProperties dictionary ) if the given property exists. /// If it exists returns the value stored in cache. /// If the property doesn't exist in cache it checks via reflection for the HtmlAsAttribute. /// If the property is marked with this attribute the string value stored in the htmlRef field /// of the HtmlAsAttribute is stored in cache, and is returned. /// </summary> /// <param name="p">The property in which there could be the HtmlAsAttribute</param> /// <returns> /// String provided by custom attribute HtmlAsAttribute /// If theres HtmlAsAtttribute in p returns null. /// </returns> private string GetHtmlAsAttribStringRef(PropertyInfo p) { String htmlRef = ""; if (htmlAsProperties.TryGetValue(p, out htmlRef)) { return(htmlRef); } HtmlAsAttribute attribute = (HtmlAsAttribute)p.GetCustomAttribute(typeof(HtmlAsAttribute)); if (attribute != null) { htmlAsProperties.Add(p, attribute.htmlRef); return(attribute.htmlRef); } return(null); }
private string GetHtmlAsAttribStringRef(string name, PropertyInfoGetter getter) { String htmlRef = ""; if (htmlAsProperties.TryGetValue(name, out htmlRef)) { return(htmlRef); } PropertyInfo p = getter.GetPropertyInfo(name); HtmlAsAttribute attribute = (HtmlAsAttribute)p.GetCustomAttribute(typeof(HtmlAsAttribute)); if (attribute != null) { htmlAsProperties.Add(name, attribute.htmlRef); return(attribute.htmlRef); } return(null); }