From e3e6a807b7c5b37071e33e284b4886d5fb493a67 Mon Sep 17 00:00:00 2001 From: Mark Michaelis Date: Sat, 12 Aug 2023 04:32:18 -0700 Subject: [PATCH 1/2] Removed Listing 14.16 as Legacy --- ...14.18.CustomAddAndRemoveHandlers.Tests.cs} | 10 ++--- ...ThePublisherAndSubscribers.Placeholder.cs} | 0 ...6.DeclaringTheOnTemperatureChangeEvent.cs} | 4 +- .../Listing14.16.UsingCustomDelegateType.cs | 45 ------------------- ...harpConceptualEquivalentOfEventCILCode.cs} | 6 +-- ...isting14.18.CustomAddAndRemoveHandlers.cs} | 2 +- 6 files changed, 11 insertions(+), 56 deletions(-) rename src/Chapter14.Tests/{Listing14.19.CustomAddAndRemoveHandlers.Tests.cs => Listing14.18.CustomAddAndRemoveHandlers.Tests.cs} (86%) rename src/Chapter14/{Listing14.04.ConnectingThePublisherAndSubscribers.Placeholder.cs => ConnectingThePublisherAndSubscribers.Placeholder.cs} (100%) rename src/Chapter14/{Listing14.17.DeclaringTheOnTemperatureChangeEvent.cs => Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs} (88%) delete mode 100644 src/Chapter14/Listing14.16.UsingCustomDelegateType.cs rename src/Chapter14/{Listing14.18.CSharpConceptualEquivalentOfEventCILCode.cs => Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs} (94%) rename src/Chapter14/{Listing14.19.CustomAddAndRemoveHandlers.cs => Listing14.18.CustomAddAndRemoveHandlers.cs} (95%) diff --git a/src/Chapter14.Tests/Listing14.19.CustomAddAndRemoveHandlers.Tests.cs b/src/Chapter14.Tests/Listing14.18.CustomAddAndRemoveHandlers.Tests.cs similarity index 86% rename from src/Chapter14.Tests/Listing14.19.CustomAddAndRemoveHandlers.Tests.cs rename to src/Chapter14.Tests/Listing14.18.CustomAddAndRemoveHandlers.Tests.cs index 693bf7380..8b4814f5c 100644 --- a/src/Chapter14.Tests/Listing14.19.CustomAddAndRemoveHandlers.Tests.cs +++ b/src/Chapter14.Tests/Listing14.18.CustomAddAndRemoveHandlers.Tests.cs @@ -1,9 +1,9 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_19.Tests; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18.Tests; -using Listing14_19; -using static AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_19.Thermostat; +using Listing14_18; +using static AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18.Thermostat; [TestClass] public class ProgramTests @@ -30,4 +30,4 @@ public void AddRemoveHandlerWorks() } -} \ No newline at end of file +} diff --git a/src/Chapter14/Listing14.04.ConnectingThePublisherAndSubscribers.Placeholder.cs b/src/Chapter14/ConnectingThePublisherAndSubscribers.Placeholder.cs similarity index 100% rename from src/Chapter14/Listing14.04.ConnectingThePublisherAndSubscribers.Placeholder.cs rename to src/Chapter14/ConnectingThePublisherAndSubscribers.Placeholder.cs diff --git a/src/Chapter14/Listing14.17.DeclaringTheOnTemperatureChangeEvent.cs b/src/Chapter14/Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs similarity index 88% rename from src/Chapter14/Listing14.17.DeclaringTheOnTemperatureChangeEvent.cs rename to src/Chapter14/Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs index 45c55678d..b1b0bb4b7 100644 --- a/src/Chapter14/Listing14.17.DeclaringTheOnTemperatureChangeEvent.cs +++ b/src/Chapter14/Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs @@ -1,8 +1,8 @@ -// This is pseudo code to represent the generated IL so guidelines not followed. +// This is pseudo code to represent the generated IL so guidelines not followed. #pragma warning disable CS0067 // The event is never used #pragma warning disable CS0469 // Field is never assigned to, and will always have its default value - null -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_17; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_16; using System; // In an actual implementation we would utilize this event diff --git a/src/Chapter14/Listing14.16.UsingCustomDelegateType.cs b/src/Chapter14/Listing14.16.UsingCustomDelegateType.cs deleted file mode 100644 index 1c0005207..000000000 --- a/src/Chapter14/Listing14.16.UsingCustomDelegateType.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_16; - -#region INCLUDE -public class Thermostat -{ - public class TemperatureArgs : System.EventArgs - { - public TemperatureArgs(float newTemperature) - { - NewTemperature = newTemperature; - } - - public float NewTemperature { get; set; } - } - - #region HIGHLIGHT - public delegate void TemperatureChangeHandler( - object sender, TemperatureArgs newTemperature); - - public event TemperatureChangeHandler? - OnTemperatureChange; - #endregion HIGHLIGHT - - public float CurrentTemperature - #region EXCLUDE - { - get { return _CurrentTemperature; } - set - { - if(value != CurrentTemperature) - { - _CurrentTemperature = value; - // If there are any subscribers - // then notify them of changes in - // temperature - // Call subscribers - OnTemperatureChange?.Invoke( - this, new TemperatureArgs(value)); - } - } - } - #endregion EXCLUDE - private float _CurrentTemperature; -} -#endregion INCLUDE diff --git a/src/Chapter14/Listing14.18.CSharpConceptualEquivalentOfEventCILCode.cs b/src/Chapter14/Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs similarity index 94% rename from src/Chapter14/Listing14.18.CSharpConceptualEquivalentOfEventCILCode.cs rename to src/Chapter14/Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs index 101c0df2d..8c3d73064 100644 --- a/src/Chapter14/Listing14.18.CSharpConceptualEquivalentOfEventCILCode.cs +++ b/src/Chapter14/Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs @@ -1,9 +1,9 @@ -// This is pseudo code to represent the generated IL so guidelines not followed. +// This is pseudo code to represent the generated IL so guidelines not followed. #pragma warning disable IDE0044 // Add readonly modifier #pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE1006 // Naming Styles -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_17; using System; #region INCLUDE @@ -59,4 +59,4 @@ public TemperatureArgs(float newTemperature) } } -} \ No newline at end of file +} diff --git a/src/Chapter14/Listing14.19.CustomAddAndRemoveHandlers.cs b/src/Chapter14/Listing14.18.CustomAddAndRemoveHandlers.cs similarity index 95% rename from src/Chapter14/Listing14.19.CustomAddAndRemoveHandlers.cs rename to src/Chapter14/Listing14.18.CustomAddAndRemoveHandlers.cs index 1e420fa9e..b1e87bed9 100644 --- a/src/Chapter14/Listing14.19.CustomAddAndRemoveHandlers.cs +++ b/src/Chapter14/Listing14.18.CustomAddAndRemoveHandlers.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_19; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18; #region INCLUDE public class Thermostat From ebf69b358ab878b40633b05c470c9f8cb8cd1afd Mon Sep 17 00:00:00 2001 From: Mark Michaelis Date: Sat, 12 Aug 2023 04:38:04 -0700 Subject: [PATCH 2/2] Removed Listing 14.06 as legacy --- ...sAndMinusEqualsDelegateOperators.Tests.cs} | 6 +-- ...ThePlusAndMinusDelegateOperators.Tests.cs} | 6 +-- ...ratureChangedThrowingAnException.Tests.cs} | 6 +-- ...andlingExceptionsFromSubscribers.Tests.cs} | 4 +- ...entOperationRatherThanPlusEquals.Tests.cs} | 4 +- ...14.17.CustomAddAndRemoveHandlers.Tests.cs} | 6 +-- ...ThePublisherAndSubscribers.Placeholder.cs} | 0 .../Listing14.06.InvokingADelegatePre6.cs | 42 ------------------- ...sEqualsAndMinusEqualsDelegateOperators.cs} | 4 +- ....UsingThePlusAndMinusDelegateOperators.cs} | 4 +- ...nTemperatureChangedThrowingAnException.cs} | 2 +- ...4.09.HandlingExceptionsFromSubscribers.cs} | 4 +- ...ssignmentOperationRatherThanPlusEquals.cs} | 4 +- ...ngTheEventFromOutsideTheEventContainer.cs} | 4 +- ...eEventKeywordWithTheEventCodingPattern.cs} | 2 +- ...ing14.13.DeclaringAGenericDelegateType.cs} | 4 +- ...isting14.14.FiringTheEventNotification.cs} | 2 +- ...5.DeclaringTheOnTemperatureChangeEvent.cs} | 2 +- ...harpConceptualEquivalentOfEventCILCode.cs} | 2 +- ...isting14.17.CustomAddAndRemoveHandlers.cs} | 2 +- 20 files changed, 34 insertions(+), 76 deletions(-) rename src/Chapter14.Tests/{Listing14.07.Tests.cs => Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.Tests.cs} (86%) rename src/Chapter14.Tests/{Listing14.08.Tests.cs => Listing14.07.UsingThePlusAndMinusDelegateOperators.Tests.cs} (86%) rename src/Chapter14.Tests/{Listing14.11.Tests.cs => Listing14.08.OnTemperatureChangedThrowingAnException.Tests.cs} (82%) rename src/Chapter14.Tests/{Listing14.09.Tests.cs => Listing14.09.HandlingExceptionsFromSubscribers.Tests.cs} (86%) rename src/Chapter14.Tests/{Listing14.10.Tests.cs => Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.Tests.cs} (86%) rename src/Chapter14.Tests/{Listing14.18.CustomAddAndRemoveHandlers.Tests.cs => Listing14.17.CustomAddAndRemoveHandlers.Tests.cs} (92%) rename src/Chapter14/{ConnectingThePublisherAndSubscribers.Placeholder.cs => Listing14.04.ConnectingThePublisherAndSubscribers.Placeholder.cs} (100%) delete mode 100644 src/Chapter14/Listing14.06.InvokingADelegatePre6.cs rename src/Chapter14/{Listing14.07.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs => Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs} (91%) rename src/Chapter14/{Listing14.08.UsingThePlusAndMinusDelegateOperators.cs => Listing14.07.UsingThePlusAndMinusDelegateOperators.cs} (91%) rename src/Chapter14/{Listing14.09.OnTemperatureChangedThrowingAnException.cs => Listing14.08.OnTemperatureChangedThrowingAnException.cs} (92%) rename src/Chapter14/{Listing14.10.HandlingExceptionsFromSubscribers.cs => Listing14.09.HandlingExceptionsFromSubscribers.cs} (97%) rename src/Chapter14/{Listing14.11.UsingTheAssignmentOperationRatherThanPlusEquals.cs => Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.cs} (91%) rename src/Chapter14/{Listing14.12.FiringTheEventFromOutsideTheEventContainer.cs => Listing14.11.FiringTheEventFromOutsideTheEventContainer.cs} (84%) rename src/Chapter14/{Listing14.13.UsingTheEventKeywordWithTheEventCodingPattern.cs => Listing14.12.UsingTheEventKeywordWithTheEventCodingPattern.cs} (91%) rename src/Chapter14/{Listing14.14.DeclaringAGenericDelegateType.cs => Listing14.13.DeclaringAGenericDelegateType.cs} (73%) rename src/Chapter14/{Listing14.15.FiringTheEventNotification.cs => Listing14.14.FiringTheEventNotification.cs} (93%) rename src/Chapter14/{Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs => Listing14.15.DeclaringTheOnTemperatureChangeEvent.cs} (98%) rename src/Chapter14/{Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs => Listing14.16.CSharpConceptualEquivalentOfEventCILCode.cs} (99%) rename src/Chapter14/{Listing14.18.CustomAddAndRemoveHandlers.cs => Listing14.17.CustomAddAndRemoveHandlers.cs} (99%) diff --git a/src/Chapter14.Tests/Listing14.07.Tests.cs b/src/Chapter14.Tests/Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.Tests.cs similarity index 86% rename from src/Chapter14.Tests/Listing14.07.Tests.cs rename to src/Chapter14.Tests/Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.Tests.cs index 2e27dbfaa..7d913bd43 100644 --- a/src/Chapter14.Tests/Listing14.07.Tests.cs +++ b/src/Chapter14.Tests/Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.Tests.cs @@ -1,6 +1,6 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_07.Tests; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_06.Tests; [TestClass] public class ProgramTests @@ -13,4 +13,4 @@ public void MainTest() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, Program.Main); } -} \ No newline at end of file +} diff --git a/src/Chapter14.Tests/Listing14.08.Tests.cs b/src/Chapter14.Tests/Listing14.07.UsingThePlusAndMinusDelegateOperators.Tests.cs similarity index 86% rename from src/Chapter14.Tests/Listing14.08.Tests.cs rename to src/Chapter14.Tests/Listing14.07.UsingThePlusAndMinusDelegateOperators.Tests.cs index 26d78b9d9..6cf5f86ad 100644 --- a/src/Chapter14.Tests/Listing14.08.Tests.cs +++ b/src/Chapter14.Tests/Listing14.07.UsingThePlusAndMinusDelegateOperators.Tests.cs @@ -1,6 +1,6 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_08.Tests; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_07.Tests; [TestClass] public class ProgramTests @@ -13,4 +13,4 @@ public void MainTest() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, Program.Main); } -} \ No newline at end of file +} diff --git a/src/Chapter14.Tests/Listing14.11.Tests.cs b/src/Chapter14.Tests/Listing14.08.OnTemperatureChangedThrowingAnException.Tests.cs similarity index 82% rename from src/Chapter14.Tests/Listing14.11.Tests.cs rename to src/Chapter14.Tests/Listing14.08.OnTemperatureChangedThrowingAnException.Tests.cs index f57c2f55c..24e29cf9d 100644 --- a/src/Chapter14.Tests/Listing14.11.Tests.cs +++ b/src/Chapter14.Tests/Listing14.08.OnTemperatureChangedThrowingAnException.Tests.cs @@ -1,6 +1,6 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_11.Tests; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_08.Tests; [TestClass] public class ProgramTests @@ -13,4 +13,4 @@ public void MainTest() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, Program.Main); } -} \ No newline at end of file +} diff --git a/src/Chapter14.Tests/Listing14.09.Tests.cs b/src/Chapter14.Tests/Listing14.09.HandlingExceptionsFromSubscribers.Tests.cs similarity index 86% rename from src/Chapter14.Tests/Listing14.09.Tests.cs rename to src/Chapter14.Tests/Listing14.09.HandlingExceptionsFromSubscribers.Tests.cs index 68c67224b..1c760b2ff 100644 --- a/src/Chapter14.Tests/Listing14.09.Tests.cs +++ b/src/Chapter14.Tests/Listing14.09.HandlingExceptionsFromSubscribers.Tests.cs @@ -1,4 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_09.Tests; @@ -13,4 +13,4 @@ public void MainTest() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, Program.Main); } -} \ No newline at end of file +} diff --git a/src/Chapter14.Tests/Listing14.10.Tests.cs b/src/Chapter14.Tests/Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.Tests.cs similarity index 86% rename from src/Chapter14.Tests/Listing14.10.Tests.cs rename to src/Chapter14.Tests/Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.Tests.cs index 2659c7cef..dc4f95ceb 100644 --- a/src/Chapter14.Tests/Listing14.10.Tests.cs +++ b/src/Chapter14.Tests/Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.Tests.cs @@ -1,4 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_10.Tests; @@ -13,4 +13,4 @@ public void MainTest() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, Program.Main); } -} \ No newline at end of file +} diff --git a/src/Chapter14.Tests/Listing14.18.CustomAddAndRemoveHandlers.Tests.cs b/src/Chapter14.Tests/Listing14.17.CustomAddAndRemoveHandlers.Tests.cs similarity index 92% rename from src/Chapter14.Tests/Listing14.18.CustomAddAndRemoveHandlers.Tests.cs rename to src/Chapter14.Tests/Listing14.17.CustomAddAndRemoveHandlers.Tests.cs index 8b4814f5c..dc870243f 100644 --- a/src/Chapter14.Tests/Listing14.18.CustomAddAndRemoveHandlers.Tests.cs +++ b/src/Chapter14.Tests/Listing14.17.CustomAddAndRemoveHandlers.Tests.cs @@ -1,9 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18.Tests; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_17.Tests; -using Listing14_18; -using static AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18.Thermostat; +using Listing14_17; +using static AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_17.Thermostat; [TestClass] public class ProgramTests diff --git a/src/Chapter14/ConnectingThePublisherAndSubscribers.Placeholder.cs b/src/Chapter14/Listing14.04.ConnectingThePublisherAndSubscribers.Placeholder.cs similarity index 100% rename from src/Chapter14/ConnectingThePublisherAndSubscribers.Placeholder.cs rename to src/Chapter14/Listing14.04.ConnectingThePublisherAndSubscribers.Placeholder.cs diff --git a/src/Chapter14/Listing14.06.InvokingADelegatePre6.cs b/src/Chapter14/Listing14.06.InvokingADelegatePre6.cs deleted file mode 100644 index 818fe5383..000000000 --- a/src/Chapter14/Listing14.06.InvokingADelegatePre6.cs +++ /dev/null @@ -1,42 +0,0 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_06; - -using System; -#region INCLUDE -public class Thermostat -{ - // Define the event publisher - public Action? OnTemperatureChange { get; set; } - - public float CurrentTemperature - { - get { return _CurrentTemperature; } - set - { - if(value != CurrentTemperature) - { - _CurrentTemperature = value; - // If there are any subscribers, - // notify them of changes in - // temperature - #region EXCLUDE - #pragma warning disable IDE1005 // Delegate invocation can be simplified. - #endregion EXCLUDE - #region HIGHLIGHT - Action? localOnChange = - OnTemperatureChange; - if(localOnChange != null) - { - // Call subscribers - localOnChange(value); - } - #endregion HIGHLIGHT - #region EXCLUDE - #pragma warning restore IDE1005 // Delegate invocation can be simplified. - #endregion EXCLUDE - } - } - } - - private float _CurrentTemperature; -} -#endregion INCLUDE diff --git a/src/Chapter14/Listing14.07.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs b/src/Chapter14/Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs similarity index 91% rename from src/Chapter14/Listing14.07.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs rename to src/Chapter14/Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs index db5fc7939..04c2ce723 100644 --- a/src/Chapter14/Listing14.07.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs +++ b/src/Chapter14/Listing14.06.UsingthePlusEqualsAndMinusEqualsDelegateOperators.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_07; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_06; using System; using Listing14_01; @@ -36,4 +36,4 @@ public static void Main() //... #endregion INCLUDE } -} \ No newline at end of file +} diff --git a/src/Chapter14/Listing14.08.UsingThePlusAndMinusDelegateOperators.cs b/src/Chapter14/Listing14.07.UsingThePlusAndMinusDelegateOperators.cs similarity index 91% rename from src/Chapter14/Listing14.08.UsingThePlusAndMinusDelegateOperators.cs rename to src/Chapter14/Listing14.07.UsingThePlusAndMinusDelegateOperators.cs index 93cbc7239..3dc557058 100644 --- a/src/Chapter14/Listing14.08.UsingThePlusAndMinusDelegateOperators.cs +++ b/src/Chapter14/Listing14.07.UsingThePlusAndMinusDelegateOperators.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_08; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_07; using System; using Listing14_01; @@ -34,4 +34,4 @@ public static void Main() //... #endregion INCLUDE } -} \ No newline at end of file +} diff --git a/src/Chapter14/Listing14.09.OnTemperatureChangedThrowingAnException.cs b/src/Chapter14/Listing14.08.OnTemperatureChangedThrowingAnException.cs similarity index 92% rename from src/Chapter14/Listing14.09.OnTemperatureChangedThrowingAnException.cs rename to src/Chapter14/Listing14.08.OnTemperatureChangedThrowingAnException.cs index fb3706e22..136298240 100644 --- a/src/Chapter14/Listing14.09.OnTemperatureChangedThrowingAnException.cs +++ b/src/Chapter14/Listing14.08.OnTemperatureChangedThrowingAnException.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_09; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_08; using System; using Listing14_01; diff --git a/src/Chapter14/Listing14.10.HandlingExceptionsFromSubscribers.cs b/src/Chapter14/Listing14.09.HandlingExceptionsFromSubscribers.cs similarity index 97% rename from src/Chapter14/Listing14.10.HandlingExceptionsFromSubscribers.cs rename to src/Chapter14/Listing14.09.HandlingExceptionsFromSubscribers.cs index fe826d936..d4f1c01fb 100644 --- a/src/Chapter14/Listing14.10.HandlingExceptionsFromSubscribers.cs +++ b/src/Chapter14/Listing14.09.HandlingExceptionsFromSubscribers.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_10; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_09; using System; using System.Collections.Generic; @@ -98,4 +98,4 @@ public static void Main() } } } -} \ No newline at end of file +} diff --git a/src/Chapter14/Listing14.11.UsingTheAssignmentOperationRatherThanPlusEquals.cs b/src/Chapter14/Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.cs similarity index 91% rename from src/Chapter14/Listing14.11.UsingTheAssignmentOperationRatherThanPlusEquals.cs rename to src/Chapter14/Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.cs index 945b63a61..0ec82b011 100644 --- a/src/Chapter14/Listing14.11.UsingTheAssignmentOperationRatherThanPlusEquals.cs +++ b/src/Chapter14/Listing14.10.UsingTheAssignmentOperationRatherThanPlusEquals.cs @@ -1,6 +1,6 @@ -using AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_02; +using AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_02; -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_11; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_10; using System; using Listing14_01; diff --git a/src/Chapter14/Listing14.12.FiringTheEventFromOutsideTheEventContainer.cs b/src/Chapter14/Listing14.11.FiringTheEventFromOutsideTheEventContainer.cs similarity index 84% rename from src/Chapter14/Listing14.12.FiringTheEventFromOutsideTheEventContainer.cs rename to src/Chapter14/Listing14.11.FiringTheEventFromOutsideTheEventContainer.cs index 178351a52..87220ac8b 100644 --- a/src/Chapter14/Listing14.12.FiringTheEventFromOutsideTheEventContainer.cs +++ b/src/Chapter14/Listing14.11.FiringTheEventFromOutsideTheEventContainer.cs @@ -1,7 +1,7 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_12; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_11; using Listing14_01; -using Listing14_10; +using Listing14_09; #region INCLUDE public class Program { diff --git a/src/Chapter14/Listing14.13.UsingTheEventKeywordWithTheEventCodingPattern.cs b/src/Chapter14/Listing14.12.UsingTheEventKeywordWithTheEventCodingPattern.cs similarity index 91% rename from src/Chapter14/Listing14.13.UsingTheEventKeywordWithTheEventCodingPattern.cs rename to src/Chapter14/Listing14.12.UsingTheEventKeywordWithTheEventCodingPattern.cs index dc2f3e689..15e2b0fbc 100644 --- a/src/Chapter14/Listing14.13.UsingTheEventKeywordWithTheEventCodingPattern.cs +++ b/src/Chapter14/Listing14.12.UsingTheEventKeywordWithTheEventCodingPattern.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_13; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_12; using System; #pragma warning disable 67 // OnTemperatureChange is declared but never used diff --git a/src/Chapter14/Listing14.14.DeclaringAGenericDelegateType.cs b/src/Chapter14/Listing14.13.DeclaringAGenericDelegateType.cs similarity index 73% rename from src/Chapter14/Listing14.14.DeclaringAGenericDelegateType.cs rename to src/Chapter14/Listing14.13.DeclaringAGenericDelegateType.cs index 383150da2..a20c8da4e 100644 --- a/src/Chapter14/Listing14.14.DeclaringAGenericDelegateType.cs +++ b/src/Chapter14/Listing14.13.DeclaringAGenericDelegateType.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_14; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_13; using System; @@ -9,4 +9,4 @@ public delegate void EventHandler( object sender, TEventArgs e) where TEventArgs : EventArgs; #endregion INCLUDE -} \ No newline at end of file +} diff --git a/src/Chapter14/Listing14.15.FiringTheEventNotification.cs b/src/Chapter14/Listing14.14.FiringTheEventNotification.cs similarity index 93% rename from src/Chapter14/Listing14.15.FiringTheEventNotification.cs rename to src/Chapter14/Listing14.14.FiringTheEventNotification.cs index 4b2c06d02..37ea0fcc8 100644 --- a/src/Chapter14/Listing14.15.FiringTheEventNotification.cs +++ b/src/Chapter14/Listing14.14.FiringTheEventNotification.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_15; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_14; using System; #region INCLUDE diff --git a/src/Chapter14/Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs b/src/Chapter14/Listing14.15.DeclaringTheOnTemperatureChangeEvent.cs similarity index 98% rename from src/Chapter14/Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs rename to src/Chapter14/Listing14.15.DeclaringTheOnTemperatureChangeEvent.cs index b1b0bb4b7..89aef133c 100644 --- a/src/Chapter14/Listing14.16.DeclaringTheOnTemperatureChangeEvent.cs +++ b/src/Chapter14/Listing14.15.DeclaringTheOnTemperatureChangeEvent.cs @@ -2,7 +2,7 @@ #pragma warning disable CS0067 // The event is never used #pragma warning disable CS0469 // Field is never assigned to, and will always have its default value - null -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_16; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_15; using System; // In an actual implementation we would utilize this event diff --git a/src/Chapter14/Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs b/src/Chapter14/Listing14.16.CSharpConceptualEquivalentOfEventCILCode.cs similarity index 99% rename from src/Chapter14/Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs rename to src/Chapter14/Listing14.16.CSharpConceptualEquivalentOfEventCILCode.cs index 8c3d73064..71b97fa12 100644 --- a/src/Chapter14/Listing14.17.CSharpConceptualEquivalentOfEventCILCode.cs +++ b/src/Chapter14/Listing14.16.CSharpConceptualEquivalentOfEventCILCode.cs @@ -3,7 +3,7 @@ #pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE1006 // Naming Styles -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_17; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_16; using System; #region INCLUDE diff --git a/src/Chapter14/Listing14.18.CustomAddAndRemoveHandlers.cs b/src/Chapter14/Listing14.17.CustomAddAndRemoveHandlers.cs similarity index 99% rename from src/Chapter14/Listing14.18.CustomAddAndRemoveHandlers.cs rename to src/Chapter14/Listing14.17.CustomAddAndRemoveHandlers.cs index b1e87bed9..c928053fc 100644 --- a/src/Chapter14/Listing14.18.CustomAddAndRemoveHandlers.cs +++ b/src/Chapter14/Listing14.17.CustomAddAndRemoveHandlers.cs @@ -1,4 +1,4 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_18; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_17; #region INCLUDE public class Thermostat