Код: Выделить всё
public class Foo
{
public string A { get; set; } = "Hello world! This is a good string!";
public string B { get; set; } = "Hello world! This is a good string!";
public string C { get; set; } = "Hello world! This is a good string!";
}
Код: Выделить всё
var foo1 = new Foo { A = "Test" };
File.WriteAllText("C:\some\path\file1.json", JsonConvert.SerializeObject(foo1));
var foo2 = new Foo { B = "Test" };
File.WriteAllText("C:\some\path\file2.json", JsonConvert.SerializeObject(foo2));
file1.json:
Код: Выделить всё
{
"A": "Test",
"B": "Hello world! This is a good string!",
"C": "Hello world! This is a good string!"
}
Код: Выделить всё
{
"A": "Hello world! This is a good string!",
"B": "Test",
"C": "Hello world! This is a good string!"
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... d-which-wi
Мобильная версия