示例#1
0
        public static ServerResult <T> create()
        {
            ServerResult <T> sr = new ServerResult <T>();

            sr.error   = new ErrorMsg();
            sr.success = true;
            return(sr);
        }
示例#2
0
 public ServerResult <T> contatenate <T, V>(ServerResult <T> mainSR, ServerResult <V> subSR)
 {
     PropertyInfo[] mainProperties = typeof(T).GetProperties();
     foreach (PropertyInfo property in mainProperties)
     {
         if (property.PropertyType.ToString() == typeof(V).ToString())
         {
             property.SetValue(mainSR.result, subSR.result as object, null);
         }
     }
     foreach (var errorMsg in subSR.error.messageList)
     {
         mainSR.error.addMessage(errorMsg, true);
     }
     if (!mainSR.success || !subSR.success)
     {
         mainSR.success = false;
     }
     return(mainSR);
 }