示例#1
0
        /// <summary>
        /// Decode a standard response to a .NET list data struct.
        /// </summary>
        /// <param name="response">StdResponseEntity instance to be decoded</param>
        /// <returns>List in .NET</returns>
        public static List <Object> DecodeList(StdResponseEntity response)
        {
            var returnElement = response.returnElement.data.ToString();
            var responseList  = (JArray)JsonConvert.DeserializeObject <Object>(returnElement);

            return(responseList.ToObject <List <Object> >());
        }
示例#2
0
        /// <summary>
        /// Decode a standard response to a .NET dictionary(string, string) data struct.
        /// </summary>
        /// <param name="response">StdResponseEntity instance to be decoded</param>
        /// <returns>Dictionary in .NET</returns>
        public static Dictionary <String, String> DecodeToStringStringDictionary(StdResponseEntity response)
        {
            var returnElement = response.returnElement.data.ToString();
            var jtoken        = (JToken)JsonConvert.DeserializeObject <Object>(returnElement);

            return(ReturnDataHelper.DecodeDictionaryJToken(jtoken));
        }
示例#3
0
        /// <summary>
        /// Decode a standard response to a .NET dataset data struct.
        /// </summary>
        /// <param name="response">StdResponseEntity instance to be decoded</param>
        /// <returns>DataSet in .NET</returns>
        public static DataSet DecodeToDataSet(StdResponseEntity response)
        {
            var returnElement = response.returnElement.data.ToString();
            var jtoken        = (JToken)JsonConvert.DeserializeObject <Object>(returnElement);
            var jtokenStr     = jtoken.ToString();
            var dataSet       = JsonConvert.DeserializeObject <DataSet>(jtokenStr);

            return(dataSet);
        }
示例#4
0
 /// <summary>
 /// Decode a standard response to string.
 /// </summary>
 /// <param name="response">StdResponseEntity instance to be decoded</param>
 /// <returns>List in .NET</returns>
 public static string DecodeString(StdResponseEntity response)
 {
     return(response.returnElement.data.ToString());
 }