From 7032b47e88ad6749bdceaddee5c14392dbd6f111 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Tue, 17 Dec 2024 01:17:29 -0800 Subject: [PATCH] refactor: Minor updates (#795) --- src/Chapter20/Listing20.02.AsynchronousWebRequest.cs | 2 -- .../Listing20.14.SynchronousHighLatencyInvocationInWPF.cs | 5 ----- ...0.15.SynchronousHighLatencyInvocationInWPFUsingAwait.cs | 6 ------ src/Chapter21/Listing21.01.SynchronousPiSections.cs | 7 +------ src/Chapter21/Listing21.02.ParallelPiCalculation.cs | 5 ----- .../Listing21.04.UnhandledExceptionsParallelIterations.cs | 7 +------ 6 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/Chapter20/Listing20.02.AsynchronousWebRequest.cs b/src/Chapter20/Listing20.02.AsynchronousWebRequest.cs index b02d16c9e..fe17496d3 100644 --- a/src/Chapter20/Listing20.02.AsynchronousWebRequest.cs +++ b/src/Chapter20/Listing20.02.AsynchronousWebRequest.cs @@ -3,7 +3,6 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter20.Listing20_02; #region INCLUDE using System; using System.IO; -using System.Net; using System.Runtime.ExceptionServices; using System.Threading.Tasks; @@ -48,7 +47,6 @@ public static void Main(string[] args) textOccurrenceCount} times at URL '{url}'."); }); - try { while (!task.Wait(100)) diff --git a/src/Chapter20/Listing20.14.SynchronousHighLatencyInvocationInWPF.cs b/src/Chapter20/Listing20.14.SynchronousHighLatencyInvocationInWPF.cs index ded53f7f9..50cce83db 100644 --- a/src/Chapter20/Listing20.14.SynchronousHighLatencyInvocationInWPF.cs +++ b/src/Chapter20/Listing20.14.SynchronousHighLatencyInvocationInWPF.cs @@ -16,8 +16,3 @@ private void PingButton_Click( #endregion INCLUDE } } - - - - - diff --git a/src/Chapter20/Listing20.15.SynchronousHighLatencyInvocationInWPFUsingAwait.cs b/src/Chapter20/Listing20.15.SynchronousHighLatencyInvocationInWPFUsingAwait.cs index 09e53554c..09df60675 100644 --- a/src/Chapter20/Listing20.15.SynchronousHighLatencyInvocationInWPFUsingAwait.cs +++ b/src/Chapter20/Listing20.15.SynchronousHighLatencyInvocationInWPFUsingAwait.cs @@ -18,11 +18,5 @@ private async void PingButton_Click( StatusLabel.Text = pingReply.Status.ToString(); } #endregion INCLUDE - } } - - - - - diff --git a/src/Chapter21/Listing21.01.SynchronousPiSections.cs b/src/Chapter21/Listing21.01.SynchronousPiSections.cs index 05afc6cf2..11dd12637 100644 --- a/src/Chapter21/Listing21.01.SynchronousPiSections.cs +++ b/src/Chapter21/Listing21.01.SynchronousPiSections.cs @@ -13,7 +13,7 @@ public static void Main() { string pi = ""; const int iterations = TotalDigits / BatchSize; - for(int i = 0; i < iterations; i++) + for (int i = 0; i < iterations; i++) { pi += PiCalculator.Calculate( BatchSize, i * BatchSize); @@ -41,8 +41,3 @@ public static string Calculate( */ #endregion EXCLUDE #endregion INCLUDE - - - - - diff --git a/src/Chapter21/Listing21.02.ParallelPiCalculation.cs b/src/Chapter21/Listing21.02.ParallelPiCalculation.cs index a11f46793..3be721794 100644 --- a/src/Chapter21/Listing21.02.ParallelPiCalculation.cs +++ b/src/Chapter21/Listing21.02.ParallelPiCalculation.cs @@ -32,8 +32,3 @@ public static void Main() } } #endregion INCLUDE - - - - - diff --git a/src/Chapter21/Listing21.04.UnhandledExceptionsParallelIterations.cs b/src/Chapter21/Listing21.04.UnhandledExceptionsParallelIterations.cs index 1890fef24..ee868b8d7 100644 --- a/src/Chapter21/Listing21.04.UnhandledExceptionsParallelIterations.cs +++ b/src/Chapter21/Listing21.04.UnhandledExceptionsParallelIterations.cs @@ -36,7 +36,7 @@ static void EncryptFiles( Console.WriteLine( "ERROR: {0}:", exception.GetType().Name); - foreach(Exception item in + foreach (Exception item in #region HIGHLIGHT exception.InnerExceptions) #endregion HIGHLIGHT @@ -56,8 +56,3 @@ private static void Encrypt(string fileName) #endregion EXCLUDE } #endregion INCLUDE - - - - -