Consider the code below. When I try to serialize this by calling the 'SaveToFile' method the property 'Name' doens't get serialized.
Any ideas?
public class Subs
{
public string Something { get; set; } = "smew";
}
public class Plep : List<Subs>
{
public string Name { get; set; } = "smew";
public void SaveToFile(string file)
{
using (StreamWriter wrt = new StreamWriter(file))
{
wrt.WriteLine(JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All,
//TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
}));
}
}
}