Beispiel #1
0
        public void ReadJsonFile()
        {
            using StreamReader sr = File.OpenText(path + inputJsonFile);
            var data = sr.ReadToEnd();

            json = JsonConvert.DeserializeObject <NumbersList>(data);
        }
Beispiel #2
0
        public void WriteToOutput2()
        {
            using StreamWriter sw = File.CreateText(path + output2JsonFile);
            NumbersList payload1 = new NumbersList()
            {
                Numbers = new List <Numbers>()
                {
                    json.Numbers[0].MultiWith(2),
                    json.Numbers[1].MultiWith(2),
                    json.Numbers[2].MultiWith(2)
                },
            };
            var obj = JsonConvert.SerializeObject((object)payload1);

            sw.WriteLine(obj);
        }
Beispiel #3
0
 public TotalNumbers(NumbersList numbers)
 {
     Total.Add(numbers.Numbers[0].Total());
     Total.Add(numbers.Numbers[1].Total());
     Total.Add(numbers.Numbers[2].Total());
 }