mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-05 06:15:24 +00:00
Initial commit
This commit is contained in:
parent
4a4a0b8e20
commit
0ff7fcc22e
6 changed files with 18 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
using System.Xml.Serialization; // XmlSerializer
|
||||
using Packt.Shared; // Person
|
||||
using NewJson = System.Text.Json.JsonSerializer;
|
||||
using FastJson = System.Text.Json.JsonSerializer;
|
||||
|
||||
using static System.Environment;
|
||||
using static System.IO.Path;
|
||||
|
|
@ -93,7 +93,7 @@ WriteLine("Written {0:N0} bytes of JSON to: {1}",
|
|||
arg0: new FileInfo(jsonPath).Length,
|
||||
arg1: jsonPath);
|
||||
|
||||
// Display the serialized object graph
|
||||
// display the serialized object graph
|
||||
WriteLine(File.ReadAllText(jsonPath));
|
||||
|
||||
WriteLine();
|
||||
|
|
@ -103,7 +103,7 @@ using (FileStream jsonLoad = File.Open(jsonPath, FileMode.Open))
|
|||
{
|
||||
// deserialize object graph into a List of Person
|
||||
List<Person>? loadedPeople =
|
||||
await NewJson.DeserializeAsync(utf8Json: jsonLoad,
|
||||
await FastJson.DeserializeAsync(utf8Json: jsonLoad,
|
||||
returnType: typeof(List<Person>)) as List<Person>;
|
||||
|
||||
if (loadedPeople is not null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue