void IValueEventListener.OnDataChange(DataSnapshot snapshot) { var dataDataType = snapshot.Value?.GetType(); Console.WriteLine($"data type of snapshot is: {dataDataType?.Name}"); var values = snapshot.Value as Android.Runtime.JavaDictionary; if (values != null) { List <T> items = new List <T>(); var data = new GoogleGson.Gson().ToJson(values); var json = JToken.Parse(data); var parsedresults = this.parseResultsFunc?.Invoke(json); if (parsedresults != null) { items.AddRange(parsedresults); } getTask.TrySetResult(items); } else { getTask.TrySetResult(new List <T>()); } }
void IValueEventListener.OnDataChange(DataSnapshot snapshot) { var values = (snapshot.Value as ArrayList)?.ToArray(); if (values != null) { List <T> items = new List <T>(); foreach (var value in values) { var data = new GoogleGson.Gson().ToJson(value); var item = JsonConvert.DeserializeObject <T>(data); items.Add(item); } getTask.TrySetResult(items); } else { getTask.TrySetResult(new List <T>()); } }