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); }
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); }