Example #1
0
        public static OrderList ReadFromJObject(JObject o)
        {
            var r = new OrderList();
            r.List = new Dictionary<int, Order>();
            foreach (var item in o)
            {
                var orderId = int.Parse(item.Key);
                var order = Order.ReadFromJObject(item.Value as JObject);
                r.List.Add(orderId, order);
            }

            return r;
        }
		public static OrderList ReadFromJObject(JObject o)
		{
		    var orderList = new OrderList() {List = new Dictionary<int, Order>()};
		    var res = o.Properties().ToList();
		    foreach (JProperty property in res)
		    {
		        orderList.List.Add(int.Parse(property.Name), Order.ReadFromJObject(property.Value as JObject));
		    }

		    return orderList;

			return new OrderList() {
                List = o.OfType<KeyValuePair<string, JToken>>().ToDictionary(item => int.Parse(item.Key), item => Order.ReadFromJObject(item.Value as JObject))
			};
		}