Warnings through Chapter12
MODIFY
src/Chapter12.Tests/Listing.12.13.Tests.cs
src/Chapter12.Tests/Listing.12.13.Tests.cs
@@ -22,6 +22,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter12.Listing12_13.Tests
(null, null), (pair.First, pair.Second));
}
+ [TestMethod]
public void CreatePair_GivenNonNullableStrings_Success()
{
Pair<string, string> pair = new Pair<string, string>("Inigo", "Montoya");

MODIFY
src/Chapter12/Chapter12.csproj
src/Chapter12/Chapter12.csproj
<PropertyGroup>
<ChapterNumber>12</ChapterNumber>
</PropertyGroup>
+ <PropertyGroup>
+ <!--Listing the warning here causes it to be a warning rather than an error.-->
+ <ExpectedWarnings>$(ExpectedWarnings)</ExpectedWarnings>
+ <IgnoredWarnings>$(IgnoredWarnings),IDE0051</IgnoredWarnings>
+ </PropertyGroup>
<Import Project="..\Chapter.props" />
<ItemGroup>
<Compile Remove="Listing12.45.CompilerValidationOfVariance.cs" />

MODIFY
src/Chapter12/Listing12.02.SupportingUndoInEtchASketchGame.cs
src/Chapter12/Listing12.02.SupportingUndoInEtchASketchGame.cs
@@ -7,13 +7,10 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter12.Listing12_02
{
public static void Main()
{
- Program p;
-
- p = new Program();
- p.Sketch();
+ Sketch();
}
- public void Sketch()
+ public static void Sketch()
{
Stack<Cell> path = new Stack<Cell>();

MODIFY
src/Chapter12/Listing12.06.ImplementingUndoWithAGenericStackClass.cs
src/Chapter12/Listing12.06.ImplementingUndoWithAGenericStackClass.cs
@@ -7,13 +7,10 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter12.Listing12_06
{
public static void Main()
{
- Program p;
-
- p = new Program();
- p.Sketch();
+ Sketch();
}
- public void Sketch()
+ public static void Sketch()
{
Stack<Cell> path = new Stack<Cell>();
Cell currentPosition;

MODIFY
src/Chapter12/Listing12.18.NestedGenericTypes.cs
src/Chapter12/Listing12.18.NestedGenericTypes.cs
@@ -9,7 +9,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter12.Listing12_18
// a warning
class Nested<U>
{
- void Method(T param0, U param1)
+ static void Method(T param0, U param1)
{
}
}

Warnings through Chapter12