예제 #1
0
파일: Extension.cs 프로젝트: ifdog/Queries
 public static string GetDescription(this ResultCode resultCode)
 {
     return(resultCode.GetType()
            .GetField(resultCode.ToString())
            .GetCustomAttribute <StatusDescriptionAttribute>()
            .Description);
 }
예제 #2
0
        public static string ToMessage(this ResultCode code)
        {
            FieldInfo field = code.GetType().GetField(code.ToString());
            ResultCodeMessageAttribute msg = (ResultCodeMessageAttribute)field.GetCustomAttribute(typeof(ResultCodeMessageAttribute));

            if (msg == null)
            {
                return("");
            }

            return(msg.Message ?? "");
        }