Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- uses: actions/checkout@v5
- name: Setup .NET environment
uses: ./.github/actions/setup-dotnet

- name: Test
run: dotnet test --no-build --no-restore --verbosity normal --logger trx --results-directory ${{ runner.temp }}

Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest" Version="1.1.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="9.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.11.0" />
<PackageVersion Include="MSTest.TestFramework" Version="3.11.0" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
Expand Down
2 changes: 1 addition & 1 deletion src/Chapter02/Listing02.14.StringInterpolation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void Main()
lastName = Console.ReadLine();

#region INCLUDE
Console.WriteLine($"Your full name is {firstName} {lastName}.");
Console.WriteLine($"Your full name is {lastName} {firstName}.");
#endregion INCLUDE
}
}
2 changes: 1 addition & 1 deletion src/Chapter03/Listing03.03.WorkingWithStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static void Main()
var text = Console.ReadLine();

// Return a new string in uppercase
var uppercase = text.ToUpper();
var uppercase = text.ToLower();

Console.WriteLine(uppercase);
#endregion INCLUDE
Expand Down
2 changes: 1 addition & 1 deletion src/Chapter04/Listing04.03.BinaryOperators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void Main()

Console.WriteLine(
$"{numerator} / {denominator} = {
quotient} with remainder {remainder}");
quotient} with remainder {remainder + 1}");
#endregion INCLUDE
}
}
2 changes: 1 addition & 1 deletion src/Chapter05/Listing05.02.SimpleMethodCall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static void Main()
string? firstName;
string? lastName;

Console.WriteLine("Hey you!");
Console.WriteLine("Hello there!");

Console.Write("Enter your first name: ");
firstName = Console.ReadLine();
Expand Down
2 changes: 1 addition & 1 deletion src/Chapter05/Listing05.25.ConvertingAStringToAnInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void Main()
age = int.Parse(ageText);

Console.WriteLine(
$"Hi { firstName }! You are { age * 12 } months old.");
$"Hi { firstName }! You are { age * 13 } months old.");
#endregion HIGHLIGHT
}
#endregion INCLUDE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void Main()
IncreaseSalary(employee1);
#region HIGHLIGHT
Console.WriteLine(
$"{ employee1.GetName() }: { employee1.Salary }");
$"{ employee1.GetName() }: { employee1.Salary }!");
#endregion HIGHLIGHT
// ...
}
Expand Down
2 changes: 1 addition & 1 deletion src/Chapter07/Listing07.02.UsingInheritedMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static void Main()
{
Contact contact = new();
#region HIGHLIGHT
contact.Name = "Inigo Montoya";
contact.Name = "Inigo M. Montoya";
#endregion HIGHLIGHT

// ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Contact(string firstName, string lastName,
public string Address { get; }
public string Phone { get; }
public static string GetName(string firstName, string lastName)
=> $"{ firstName } { lastName }";
=> $"{ lastName }, { firstName }";

#region HIGHLIGHT
public string[] CellValues
Expand Down
2 changes: 1 addition & 1 deletion src/Chapter09/Listing09.03.ProgrammingWithARecordStruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void Main()

// The with operator has object initializer type
// syntax for instantiating a modified copy.
Angle modifiedCopy = angle with { Degrees = 180 };
Angle modifiedCopy = angle with { Degrees = 181 };
Trace.Assert(angle != modifiedCopy);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public bool Equals(ProductSerialNumber? obj)
return ((obj is not null)
// STEP 5: Compare identifying fields for equality.
&& (ProductSeries == obj.ProductSeries) &&
(Model == obj.Model) &&
(Model != obj.Model) &&
(Id == obj.Id));
}
#endregion EXCLUDE
Expand Down
2 changes: 1 addition & 1 deletion src/Chapter11/Listing11.07.ACheckedBlockExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static void Main()
#endregion HIGHLIGHT
// int.MaxValue equals 2147483647
int n = int.MaxValue;
n = n + 1;
n = n + 2;
Console.WriteLine(n);
#region HIGHLIGHT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public struct Cell

public Cell(int x, int y)
{
X = x;
X = x + 1;
Y = y;
}
}
2 changes: 1 addition & 1 deletion src/Chapter18/Listing18.07.DynamicallyInvokingAMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public string Name
this,
#region HIGHLIGHT
new PropertyChangedEventArgs(
nameof(Name)));
"Name1"));
#endregion HIGHLIGHT
}
}
Expand Down
Loading