示例#1
0
        public static string[] DumpValue <T>(this ResourceResponse <T> response) where T : Resource, new()
        {
            var result = Enumerable.Empty <string>();

            if (response.ResponseHeaders != null)
            {
                result = response.ResponseHeaders.AllKeys.Select(
                    key => string.Format("\t{0}={1}", key, response.ResponseHeaders[key]));
            }

            var properties = response.GetType()
                             .GetProperties(BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.Instance)
                             .Select(info => string.Format("{0}={1}", info.Name, info.GetValue(response)?.ToString()));

            return(properties.Concat(result).ToArray());
        }