ch 14 & 15 single lines
MODIFY
src/Chapter14/Listing14.03.ConnectingThePublisherAndSubscribers.cs
src/Chapter14/Listing14.03.ConnectingThePublisherAndSubscribers.cs
string? temperature = Console.ReadLine();
if (!int.TryParse(temperature, out int currentTemperature))
{
- Console.WriteLine
- ($"'{temperature}' is not a valid integer.");
+ Console.WriteLine($"'{temperature}' is not a valid integer.");
return;
}
thermostat.CurrentTemperature = currentTemperature;

MODIFY
src/Chapter14/Listing14.09.OnTemperatureChangedThrowingAnException.cs
src/Chapter14/Listing14.09.OnTemperatureChangedThrowingAnException.cs
string? temperature = Console.ReadLine();
if (!int.TryParse(temperature, out int currentTemperature))
{
- Console.WriteLine($"'{temperature}'" +
- $" is not a valid integer.");
+ Console.WriteLine($"'{temperature}' is not a valid integer.");
return;
}
thermostat.CurrentTemperature = currentTemperature;

MODIFY
src/Chapter14/Listing14.11.UsingTheAssignmentOperationRatherThanPlusEquals.cs
src/Chapter14/Listing14.11.UsingTheAssignmentOperationRatherThanPlusEquals.cs
@@ -27,8 +27,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter14.Listing14_11
string? temperature = Console.ReadLine();
if (!int.TryParse(temperature, out int currentTemperature))
{
- Console.WriteLine($"'{temperature}' " +
- $"is not a valid integer.");
+ Console.WriteLine($"'{temperature}' is not a valid integer.");
return;
}
thermostat.CurrentTemperature = currentTemperature;

MODIFY
src/Chapter14/Listing14.19.CustomAddAndRemoveHandlers.cs
src/Chapter14/Listing14.19.CustomAddAndRemoveHandlers.cs
add
{
_OnTemperatureChange =
- (EventHandler<TemperatureArgs>)System.Delegate.Combine
- (value, _OnTemperatureChange);
+ (EventHandler<TemperatureArgs>)
+ System.Delegate.Combine(value, _OnTemperatureChange);
}
remove
{
_OnTemperatureChange =
- (EventHandler<TemperatureArgs>?)System.Delegate.Remove
- (_OnTemperatureChange, value);
+ (EventHandler<TemperatureArgs>?)
+ System.Delegate.Remove(_OnTemperatureChange, value);
}
}
protected EventHandler<TemperatureArgs>? _OnTemperatureChange;

MODIFY
src/Chapter15/Listing15.22.CreatingAChildCollectionWithSystem.Linq.Enumerable.GroupJoin.cs
src/Chapter15/Listing15.22.CreatingAChildCollectionWithSystem.Linq.Enumerable.GroupJoin.cs
@@ -15,9 +15,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter15.Listing15_22
Department[] departments = CorporateData.Departments;
Employee[] employees = CorporateData.Employees;
- IEnumerable<
- (long Id, string Name, IEnumerable<Employee> Employees)>
- items =
+ IEnumerable<(long Id, string Name, IEnumerable<Employee> Employees)> items =
departments.GroupJoin(
employees,
department => department.Id,
@@ -29,8 +27,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter15.Listing15_22
));
foreach (
- (_, string name, IEnumerable<Employee> employeeCollection)
- in items)
+ (_, string name, IEnumerable<Employee> employeeCollection) in items)
{
Console.WriteLine(name);
foreach (Employee employee in employeeCollection)

ch 14 & 15 single lines