Ejemplo n.º 1
0
    static public string ToStringSub(this object pClass)
    {
        string          strString  = pClass.ToString();
        RegistSubString pAttribute = pClass.GetType().GetCustomAttribute(typeof(RegistSubString), false) as RegistSubString;

        if (pAttribute != null)
        {
            strString = pAttribute.strSubString;
        }

        return(strString);
    }
Ejemplo n.º 2
0
    static public string ToStringSub(this System.Enum eEnum)
    {
        string    strString  = eEnum.ToString();
        Type      pType      = eEnum.GetType();
        FieldInfo pFieldInfo = pType.GetField(strString);

        if (pFieldInfo != null)
        {
            RegistSubString pAttribute = pFieldInfo.GetCustomAttribute(typeof(RegistSubString), false) as RegistSubString;
            if (pAttribute != null)
            {
                strString = pAttribute.strSubString;
            }
        }

        return(strString);
    }