コード例 #1
0
        private static ScheduleModel ParseSchedule(string jsonString)
        {
            ScheduleModel model = new ScheduleModel();

            try
            {
                JObject o = JObject.Parse(jsonString);
                JArray  a = (JArray)o["Android"];

                foreach (var i in a)
                {
                    model.ScheduleItems.Add(new ScheduleItem()
                    {
                        Batch   = (string)i["batch"],
                        Course  = (string)i["course"],
                        Date1   = (string)i["date1"],
                        Faculty = (string)i["faculty"],
                        Result  = (string)i["result"],
                        Room    = (string)i["room"],
                        Slot    = (string)i["slot"]
                    });
                }
            }
            catch (Exception)
            {
                return(new ScheduleModel());
            }

            return(model);
        }
コード例 #2
0
        private static ScheduleModel ParseSchedule(string jsonString)
        {
            ScheduleModel model = new ScheduleModel();
            
            try
            {
                JObject o = JObject.Parse(jsonString);
                JArray a = (JArray)o["Android"];

                foreach (var i in a)
                {
                    model.ScheduleItems.Add(new ScheduleItem()
                    {
                        Batch = (string)i["batch"],
                        Course = (string)i["course"],
                        Date1 = (string)i["date1"],
                        Faculty = (string)i["faculty"],
                        Result = (string)i["result"],
                        Room = (string)i["room"],
                        Slot = (string)i["slot"]
                    }); 
                }
            }
            catch (Exception)
            {
                return new ScheduleModel();
            }

            return model;
        }