I'm new to C#, so please bear with me :)
I have a List of persons like this:
List<Person> PersonsList = new List<Person>();
each Person has three properties:
public string Name { get; set; }
public string Number{ get; set; }
public Adress Adress { get; set; }
and I'm filling it from a text-file, now I need to change the list into a JSON file.
var list = Enumerable.Repeat(PersonsList , PersonsList.Count);
var json =JsonConvert.SerializeObject(list);
But I know it is not working because I'm not iterating over PersonsList
in Enumerable.Repeat
Can you give me a way around plz?
>` where `List` is repeated `PersonsList.Count` times. Perhaps you just meant `JsonConvert.SerializeObject(PersonsList)`?
– ProgrammingLlama Oct 09 '18 at 08:16