CodePlex.XPathParser.Extensions.GetLiteral C# (CSharp) Метод

GetLiteral() публичный статический Метод

public static GetLiteral ( this en ) : string
en this
Результат string
        public static string GetLiteral(this System.Enum en)
        {
            System.Type type = en.GetType();
            System.Reflection.MemberInfo[] memInfo = type.GetMember(en.ToString());
            if (memInfo != null && memInfo.Length > 0)
            {
                object[] attrs = memInfo[0].GetCustomAttributes(typeof(Literal),
                                                                false);
                if (attrs != null && attrs.Length > 0)
                    return ((Literal)attrs[0]).Text;
            }
            return null;
        }
Extensions