diff --git a/vs4win/Chapter09/WorkingWithFileSystems/Program.cs b/vs4win/Chapter09/WorkingWithFileSystems/Program.cs index cf4213e..eb45ecf 100644 --- a/vs4win/Chapter09/WorkingWithFileSystems/Program.cs +++ b/vs4win/Chapter09/WorkingWithFileSystems/Program.cs @@ -56,19 +56,19 @@ string newFolder = Combine( WriteLine($"Working with: {newFolder}"); // check if it exists -WriteLine($"Does it exist? {Exists(newFolder)}"); +WriteLine($"Does it exist? {Path.Exists(newFolder)}"); // create directory WriteLine("Creating it..."); CreateDirectory(newFolder); -WriteLine($"Does it exist? {Exists(newFolder)}"); +WriteLine($"Does it exist? {Path.Exists(newFolder)}"); Write("Confirm the directory exists, and then press ENTER: "); ReadLine(); // delete directory WriteLine("Deleting it..."); Delete(newFolder, recursive: true); -WriteLine($"Does it exist? {Exists(newFolder)}"); +WriteLine($"Does it exist? {Path.Exists(newFolder)}"); SectionTitle("Managing files"); @@ -123,7 +123,7 @@ WriteLine($"File Extension: {GetExtension(textFile)}"); WriteLine($"Random File Name: {GetRandomFileName()}"); WriteLine($"Temporary File Name: {GetTempFileName()}"); -SectionTitle("Getting file information "); +SectionTitle("Getting file information"); FileInfo info = new(backupFile); WriteLine($"{backupFile}:"); diff --git a/vs4win/Chapter09/WorkingWithJson/Program.cs b/vs4win/Chapter09/WorkingWithJson/Program.cs index eb6c8bd..1617501 100644 --- a/vs4win/Chapter09/WorkingWithJson/Program.cs +++ b/vs4win/Chapter09/WorkingWithJson/Program.cs @@ -4,7 +4,7 @@ using static System.Environment; using static System.IO.Path; Book mybook = new(title: - "C# 11 and .NET 7 - Modern Cross-platform Development") + "C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals") { Author = "Mark J Price", PublishDate = new(year: 2022, month: 11, day: 8), @@ -35,5 +35,5 @@ WriteLine("Written {0:N0} bytes of JSON to {1}", arg1: filePath); WriteLine(); -// Display the serialized object graph +// display the serialized object graph WriteLine(File.ReadAllText(filePath)); diff --git a/vs4win/Chapter09/WorkingWithSerialization/Program.cs b/vs4win/Chapter09/WorkingWithSerialization/Program.cs index 4ebf83f..4515e3a 100644 --- a/vs4win/Chapter09/WorkingWithSerialization/Program.cs +++ b/vs4win/Chapter09/WorkingWithSerialization/Program.cs @@ -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? loadedPeople = - await NewJson.DeserializeAsync(utf8Json: jsonLoad, + await FastJson.DeserializeAsync(utf8Json: jsonLoad, returnType: typeof(List)) as List; if (loadedPeople is not null) diff --git a/vscode/Chapter09/WorkingWithFileSystems/Program.cs b/vscode/Chapter09/WorkingWithFileSystems/Program.cs index cf4213e..eb45ecf 100644 --- a/vscode/Chapter09/WorkingWithFileSystems/Program.cs +++ b/vscode/Chapter09/WorkingWithFileSystems/Program.cs @@ -56,19 +56,19 @@ string newFolder = Combine( WriteLine($"Working with: {newFolder}"); // check if it exists -WriteLine($"Does it exist? {Exists(newFolder)}"); +WriteLine($"Does it exist? {Path.Exists(newFolder)}"); // create directory WriteLine("Creating it..."); CreateDirectory(newFolder); -WriteLine($"Does it exist? {Exists(newFolder)}"); +WriteLine($"Does it exist? {Path.Exists(newFolder)}"); Write("Confirm the directory exists, and then press ENTER: "); ReadLine(); // delete directory WriteLine("Deleting it..."); Delete(newFolder, recursive: true); -WriteLine($"Does it exist? {Exists(newFolder)}"); +WriteLine($"Does it exist? {Path.Exists(newFolder)}"); SectionTitle("Managing files"); @@ -123,7 +123,7 @@ WriteLine($"File Extension: {GetExtension(textFile)}"); WriteLine($"Random File Name: {GetRandomFileName()}"); WriteLine($"Temporary File Name: {GetTempFileName()}"); -SectionTitle("Getting file information "); +SectionTitle("Getting file information"); FileInfo info = new(backupFile); WriteLine($"{backupFile}:"); diff --git a/vscode/Chapter09/WorkingWithJson/Program.cs b/vscode/Chapter09/WorkingWithJson/Program.cs index eb6c8bd..1617501 100644 --- a/vscode/Chapter09/WorkingWithJson/Program.cs +++ b/vscode/Chapter09/WorkingWithJson/Program.cs @@ -4,7 +4,7 @@ using static System.Environment; using static System.IO.Path; Book mybook = new(title: - "C# 11 and .NET 7 - Modern Cross-platform Development") + "C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals") { Author = "Mark J Price", PublishDate = new(year: 2022, month: 11, day: 8), @@ -35,5 +35,5 @@ WriteLine("Written {0:N0} bytes of JSON to {1}", arg1: filePath); WriteLine(); -// Display the serialized object graph +// display the serialized object graph WriteLine(File.ReadAllText(filePath)); diff --git a/vscode/Chapter09/WorkingWithSerialization/Program.cs b/vscode/Chapter09/WorkingWithSerialization/Program.cs index 4ebf83f..4515e3a 100644 --- a/vscode/Chapter09/WorkingWithSerialization/Program.cs +++ b/vscode/Chapter09/WorkingWithSerialization/Program.cs @@ -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? loadedPeople = - await NewJson.DeserializeAsync(utf8Json: jsonLoad, + await FastJson.DeserializeAsync(utf8Json: jsonLoad, returnType: typeof(List)) as List; if (loadedPeople is not null)