public static TradeHistory ReadFromJObject(JObject o) { return(new TradeHistory { List = ((IDictionary <string, JToken>)o).ToDictionary(item => int.Parse(item.Key), item => Trade.ReadFromJObject(item.Value as JObject)) }); }
public static TradeHistory ReadFromJObject(JObject o) { var r = new TradeHistory(); r.List = new Dictionary <int, Trade>(); foreach (var item in o) { var tradeId = int.Parse(item.Key); var trade = Trade.ReadFromJObject(item.Value as JObject); r.List.Add(tradeId, trade); } return(r); }
public static TradeHistory ReadFromJObject(JObject o) { var list = new TradeHistory(); list.List = new Dictionary <int, Trade>(); foreach (var VARIABLE in o) { list.List.Add(key: int.Parse(VARIABLE.Key.ToString()), value: Trade.ReadFromJObject(VARIABLE.Value as JObject)); } return(list); //return new TradeHistory() { // List = o.OfType<KeyValuePair<string, JToken>>().ToDictionary(item => int.Parse(item.Key), item => Trade.ReadFromJObject(item.Value as JObject)) //}; }
public static TradeHistory ReadFromJObject(JObject o) { return(new TradeHistory() { List = o.OfType <KeyValuePair <string, JToken> >().ToDictionary(item => int.Parse(item.Key), item => Trade.ReadFromJObject(item.Value as JObject)) }); }