E() private méthode

private E ( string message ) : void
message string
Résultat void
        public static T Parse <T>(string json) where T : IConvertableFromNative <T>, new()
        {
            T result = new T();

            if (string.IsNullOrEmpty(json))
            {
                // return immediately in case of unexpected empty/null json
                GetSocialDebugLogger.E("ParseList is parsing null or empty json string");
                return(result);
            }

            return(result.ParseFromJson(json.ToDict()));
        }
Exemple #2
0
        public static Dictionary <string, TValue> ParseDictionary <TValue>(string json)
            where TValue : IConvertableFromNative <TValue>, new()
        {
            var result = new Dictionary <string, TValue>();

            if (string.IsNullOrEmpty(json))
            {
                // return immediately in case of unexpected empty/null json
                GetSocialDebugLogger.E("ParseDictionary is parsing null or empty json string");
                return(result);
            }

            var stringDict = ParseDictionary(json);

            foreach (var keyValuePairs in stringDict)
            {
                result.Add(keyValuePairs.Key, Parse <TValue>(keyValuePairs.Value));
            }
            return(result);
        }
        public static Dictionary <string, T> ParseDictionary <T>(string json)
            where T : IConvertableFromNative <T>, new()
        {
            var result = new Dictionary <string, T>();

            if (string.IsNullOrEmpty(json))
            {
                // return immediately in case of unexpected empty/null json
                GetSocialDebugLogger.E("ParseDictionary is parsing null or empty json string");
                return(result);
            }

            var objectDict = ToDict(json);

            foreach (var keyValuePairs in objectDict)
            {
                T value = new T();
                result.Add(keyValuePairs.Key, value.ParseFromJson((Dictionary <string, object>)keyValuePairs.Value));
            }
            return(result);
        }
        public static List <T> ParseList <T>(string json) where T : IConvertableFromNative <T>, new()
        {
            var result = new List <T>();

            if (string.IsNullOrEmpty(json))
            {
                // return immediately in case of unexpected empty/null json
                GetSocialDebugLogger.E("ParseList is parsing null or empty json string");
                return(result);
            }


            var entities = GSJson.Deserialize(json) as List <object>;

            if (entities == null)
            {
                return(result);
            }
            return(entities
                   .ConvertAll(item => item as Dictionary <string, object>)
                   .ConvertAll(entity => new T().ParseFromJson(entity)));
        }