Exemple #1
0
        /// <summary>
        /// Get the value of an attribute, as a value in the given Enum type.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="enumType"></param>
        /// <returns></returns>
        protected object GetEnumAttr(string name, Type enumType)
        {
            string a = this.GetAttribute(name);

            return(EnumParser.Parse(a, enumType));
        }
Exemple #2
0
        /// <summary>
        /// Get the value of an attribute, as a value in the given Enum type.
        /// The specified enum should have a member with value -1, which will
        /// be returned if the attribute doesn't exist or is in the wrong format.
        /// </summary>
        /// <typeparam name="T">The enum type</typeparam>
        /// <param name="name">The attribute name</param>
        /// <returns>The enum value</returns>
        protected T GetEnumAttr <T>(string name)
        {
            string a = this.GetAttribute(name);

            return(EnumParser.Parse <T>(a));
        }