Exemplo n.º 1
0
        /// <summary>
        /// Add "id" attribute with value only if <paramref name="condition"/> - <c>true</c>
        /// </summary>
        /// <param name="tag"><see cref="TagWrapper"/></param>
        /// <param name="condition">Condition, which define will be added content or not </param>
        /// <param name="value">Id attribute value</param>
        /// <returns>Changed <see cref="TagWrapper"/></returns>
        public static TagWrapper AddIdIf(this TagWrapper tag, bool condition, string value)
        {
            if (condition && !string.IsNullOrEmpty(value))
            {
                return(tag.AddId(value));
            }

            return(tag);
        }