diff --git a/vs4win/Chapter06/Chapter06.sln b/vs4win/Chapter06/Chapter06.sln index d5411da..cd3c807 100644 --- a/vs4win/Chapter06/Chapter06.sln +++ b/vs4win/Chapter06/Chapter06.sln @@ -11,7 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NullHandling", "NullHandlin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeAnalyzing", "CodeAnalyzing\CodeAnalyzing.csproj", "{2E477494-6458-437D-8CB7-A1803A64786C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ch06Ex02Inheritance", "Ch06Ex02Inheritance\Ch06Ex02Inheritance.csproj", "{BE4C568B-3904-42DA-8F46-14E0F76E7BED}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ch06Ex02Inheritance", "Ch06Ex02Inheritance\Ch06Ex02Inheritance.csproj", "{BE4C568B-3904-42DA-8F46-14E0F76E7BED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WarningsAsErrors", "WarningsAsErrors\WarningsAsErrors.csproj", "{F1DE0C2A-4988-46B8-AC6B-BF9E82F27E59}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,6 +41,10 @@ Global {BE4C568B-3904-42DA-8F46-14E0F76E7BED}.Debug|Any CPU.Build.0 = Debug|Any CPU {BE4C568B-3904-42DA-8F46-14E0F76E7BED}.Release|Any CPU.ActiveCfg = Release|Any CPU {BE4C568B-3904-42DA-8F46-14E0F76E7BED}.Release|Any CPU.Build.0 = Release|Any CPU + {F1DE0C2A-4988-46B8-AC6B-BF9E82F27E59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1DE0C2A-4988-46B8-AC6B-BF9E82F27E59}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1DE0C2A-4988-46B8-AC6B-BF9E82F27E59}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1DE0C2A-4988-46B8-AC6B-BF9E82F27E59}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/vs4win/Chapter06/WarningsAsErrors/Program.cs b/vs4win/Chapter06/WarningsAsErrors/Program.cs new file mode 100644 index 0000000..457d860 --- /dev/null +++ b/vs4win/Chapter06/WarningsAsErrors/Program.cs @@ -0,0 +1,9 @@ +// See https://aka.ms/new-console-template for more information +Console.Write("Enter a name: "); +string? name = Console.ReadLine(); +if (name == null) +{ + Console.WriteLine("You did not enter a name."); + return; +} +Console.WriteLine($"Hello, {name} has {name.Length} characters!"); diff --git a/vs4win/Chapter06/WarningsAsErrors/WarningsAsErrors.csproj b/vs4win/Chapter06/WarningsAsErrors/WarningsAsErrors.csproj new file mode 100644 index 0000000..f7b91d5 --- /dev/null +++ b/vs4win/Chapter06/WarningsAsErrors/WarningsAsErrors.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + enable + enable + true + + + diff --git a/vscode/Chapter06/Chapter06.code-workspace b/vscode/Chapter06/Chapter06.code-workspace index 2ddc5b7..c7d5086 100644 --- a/vscode/Chapter06/Chapter06.code-workspace +++ b/vscode/Chapter06/Chapter06.code-workspace @@ -12,6 +12,9 @@ { "path": "CodeAnalyzing" }, + { + "path": "WarningsAsErrors" + }, { "path": "Ch06Ex02Inheritance" } diff --git a/vscode/Chapter06/WarningsAsErrors/Program.cs b/vscode/Chapter06/WarningsAsErrors/Program.cs new file mode 100644 index 0000000..457d860 --- /dev/null +++ b/vscode/Chapter06/WarningsAsErrors/Program.cs @@ -0,0 +1,9 @@ +// See https://aka.ms/new-console-template for more information +Console.Write("Enter a name: "); +string? name = Console.ReadLine(); +if (name == null) +{ + Console.WriteLine("You did not enter a name."); + return; +} +Console.WriteLine($"Hello, {name} has {name.Length} characters!"); diff --git a/vscode/Chapter06/WarningsAsErrors/WarningsAsErrors.csproj b/vscode/Chapter06/WarningsAsErrors/WarningsAsErrors.csproj new file mode 100644 index 0000000..f7b91d5 --- /dev/null +++ b/vscode/Chapter06/WarningsAsErrors/WarningsAsErrors.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + enable + enable + true + + +