/// <summary> /// Retrieves a string describing the compatibility mode of the given quirksmode. /// </summary> /// <param name="mode">A specific quriks mode.</param> /// <returns>The compatibility string.</returns> internal static String GetCompatiblity(this QuirksMode mode) { var field = typeof(QuirksMode).GetField(mode.ToString()); var description = field.GetCustomAttribute <DomDescriptionAttribute>()?.Description; return(description ?? "CSS1Compat"); }
/// <summary> /// Retrieves a string describing the compatibility mode of the given quirksmode. /// </summary> /// <param name="mode">A specific quriks mode.</param> /// <returns>The compatibility string.</returns> public static String GetCompatiblity(this QuirksMode mode) { var type = typeof(QuirksMode).GetTypeInfo(); var field = type.GetDeclaredField(mode.ToString()); var description = field.GetCustomAttribute <DomDescriptionAttribute>()?.Description; return(description ?? "CSS1Compat"); }
/// <summary> /// Retrieves a string describing the compatibility mode of the given quirksmode. /// </summary> /// <param name="mode">A specific quriks mode.</param> /// <returns>The compatibility string.</returns> public static String GetCompatiblity(this QuirksMode mode) { var attr = typeof(QuirksMode).GetTypeInfo().GetDeclaredField(mode.ToString()).GetCustomAttribute <DomDescriptionAttribute>(); if (attr != null) { return(attr.Description); } return("CSS1Compat"); }
/// <summary> /// Retrieves a string describing the compatibility mode of the given quirksmode. /// </summary> /// <param name="mode">A specific quriks mode.</param> /// <returns>The compatibility string.</returns> internal static String GetCompatiblity(this QuirksMode mode) { var description = "CSS1Compat"; var fieldName = mode.ToString(); if (fieldName != null) { var field = typeof(QuirksMode).GetField(fieldName); if (field != null) { var domDescriptionAttribute = field.GetCustomAttribute <DomDescriptionAttribute>(); if (domDescriptionAttribute != null) { description = domDescriptionAttribute.Description; } } } return(description); }