コード例 #1
0
        private void WriteToFileCountries(string path, IEnumerable <JsonCountryReportModel> reportCollection)
        {
            foreach (var rep in reportCollection)
            {
                var data = new JsonCountryReportModel
                {
                    Country = rep.Country,
                    Region  = rep.Region
                };

                string json = JsonConvert.SerializeObject(data, Formatting.Indented);

                using (StreamWriter sw = new StreamWriter(path + rep.Country + ".json"))
                {
                    sw.WriteLine(json);
                }
            }
        }
コード例 #2
0
        private void WriteToFileCountries(string path, IEnumerable<JsonCountryReportModel> reportCollection)
        {
            foreach (var rep in reportCollection)
            {
                var data = new JsonCountryReportModel
                {
                    Country = rep.Country,
                    Region = rep.Region
                };

                string json = JsonConvert.SerializeObject(data, Formatting.Indented);

                using (StreamWriter sw = new StreamWriter(path + rep.Country + ".json"))
                {
                    sw.WriteLine(json);
                }
            }
        }