diff --git a/src/Chapter03/Chapter03.csproj b/src/Chapter03/Chapter03.csproj index 5ceff6f9b..c50dd10f2 100644 --- a/src/Chapter03/Chapter03.csproj +++ b/src/Chapter03/Chapter03.csproj @@ -13,7 +13,7 @@ - + @@ -25,8 +25,7 @@ PreserveNewest - - + diff --git a/src/Chapter03/Listing03.01.CheckingForNull.cs b/src/Chapter03/Listing03.01.CheckingForNull.cs index bf1c30580..2827bdf5f 100644 --- a/src/Chapter03/Listing03.01.CheckingForNull.cs +++ b/src/Chapter03/Listing03.01.CheckingForNull.cs @@ -2,16 +2,16 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_01 { public class Program { + #region INCLUDE public static void Main(string[] args) { int? number = null; - - // ... - if(args.Length>0) + #region EXCLUDE + if (args.Length>0) { number = args[0].Length; } - + #endregion if (number is null) { System.Console.WriteLine( @@ -22,8 +22,8 @@ public static void Main(string[] args) System.Console.WriteLine( $"'number' doubled is { number * 2 }."); } - } + #endregion } } diff --git a/src/Chapter03/Listing03.02.DereferencingAnUnassignedVariable.cs b/src/Chapter03/Listing03.02.DereferencingAnUnassignedVariable.cs index 93f8dcf73..6ed4ed036 100644 --- a/src/Chapter03/Listing03.02.DereferencingAnUnassignedVariable.cs +++ b/src/Chapter03/Listing03.02.DereferencingAnUnassignedVariable.cs @@ -2,13 +2,15 @@ //{ public class Program { + #region INCLUDE + #nullable enable public static void Main() { string? text; // ... - // Compile Error: Use of unassigned local variable 'text' System.Console.WriteLine(text.Length); } + #endregion } //} diff --git a/src/Chapter03/Listing03.03.EnablingNullableProjectWide-PlaceHolderFile.cs b/src/Chapter03/Listing03.03.EnablingNullableProjectWide-PlaceHolderFile.cs deleted file mode 100644 index d09be3d9d..000000000 --- a/src/Chapter03/Listing03.03.EnablingNullableProjectWide-PlaceHolderFile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_03 -{ - class Listing03 - { - } -} diff --git a/src/Chapter03/Listing03.03.EnablingNullableProjectWide.csproj.xml b/src/Chapter03/Listing03.03.EnablingNullableProjectWide.cs similarity index 51% rename from src/Chapter03/Listing03.03.EnablingNullableProjectWide.csproj.xml rename to src/Chapter03/Listing03.03.EnablingNullableProjectWide.cs index 36c64642f..ca3da2d8e 100644 --- a/src/Chapter03/Listing03.03.EnablingNullableProjectWide.csproj.xml +++ b/src/Chapter03/Listing03.03.EnablingNullableProjectWide.cs @@ -1,7 +1,9 @@ - +#region INCLUDE + Exe - net5.0 + net6.0 enable +#endregion diff --git a/src/Chapter03/Listing03.04.WorkingWithStrings.cs b/src/Chapter03/Listing03.04.WorkingWithStrings.cs index 53c56c5d3..458f7aab6 100644 --- a/src/Chapter03/Listing03.04.WorkingWithStrings.cs +++ b/src/Chapter03/Listing03.04.WorkingWithStrings.cs @@ -1,5 +1,6 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_04 { + #region INCLUDE public class Uppercase { public static void Main() @@ -13,4 +14,5 @@ public static void Main() System.Console.WriteLine(uppercase); } } + #endregion } diff --git a/src/Chapter03/Listing03.05.ImplicitLocalVariablesWithAnonymousTypes.cs b/src/Chapter03/Listing03.05.ImplicitLocalVariablesWithAnonymousTypes.cs index 448b62bdc..6985df702 100644 --- a/src/Chapter03/Listing03.05.ImplicitLocalVariablesWithAnonymousTypes.cs +++ b/src/Chapter03/Listing03.05.ImplicitLocalVariablesWithAnonymousTypes.cs @@ -1,5 +1,6 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_05 { + #region INCLUDE public class Program { public static void Main() @@ -17,4 +18,5 @@ public static void Main() $"{patent2.Title} ({patent2.YearOfPublication})"); } } + #endregion } diff --git a/src/Chapter03/Listing03.06.TheCSharpEquivalentOfCompilerGeneratedCILCodeForAValueTupleReturn.cs b/src/Chapter03/Listing03.06.TheCSharpEquivalentOfCompilerGeneratedCILCodeForAValueTupleReturn.cs index 96a65e8f6..7505a98f2 100644 --- a/src/Chapter03/Listing03.06.TheCSharpEquivalentOfCompilerGeneratedCILCodeForAValueTupleReturn.cs +++ b/src/Chapter03/Listing03.06.TheCSharpEquivalentOfCompilerGeneratedCILCodeForAValueTupleReturn.cs @@ -1,13 +1,10 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_06 { - namespace Chapter03 + #region INCLUDE + [return: System.Runtime.CompilerServices.TupleElementNames(new string[] { "First", "Second" })] + public System.ValueTuple ParseNames(string fullName) { - [return: System.Runtime.CompilerServices.TupleElementNames(new string[] { "First", "Second" })] - public System.ValueTuple ParseNames(string fullName) - { - // ... - } - + // ... } - + #endregion } diff --git a/src/Chapter03/Listing03.07.DeclaringAnArray.cs b/src/Chapter03/Listing03.07.DeclaringAnArray.cs index 17a36ed26..46f005eb7 100644 --- a/src/Chapter03/Listing03.07.DeclaringAnArray.cs +++ b/src/Chapter03/Listing03.07.DeclaringAnArray.cs @@ -5,7 +5,9 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages; + #endregion } } } diff --git a/src/Chapter03/Listing03.08.DeclaringATwoDimensionalArray.cs b/src/Chapter03/Listing03.08.DeclaringATwoDimensionalArray.cs index 8c631826f..d5540f5a7 100644 --- a/src/Chapter03/Listing03.08.DeclaringATwoDimensionalArray.cs +++ b/src/Chapter03/Listing03.08.DeclaringATwoDimensionalArray.cs @@ -5,12 +5,14 @@ public class Program { public static void Main() { + #region INCLUDE // | | // ---+---+--- // | | // ---+---+--- // | | int[,] cells; + #endregion } } } diff --git a/src/Chapter03/Listing03.09.ArrayDeclarationWithAssignment.cs b/src/Chapter03/Listing03.09.ArrayDeclarationWithAssignment.cs index 4ac76c1e1..ebff516aa 100644 --- a/src/Chapter03/Listing03.09.ArrayDeclarationWithAssignment.cs +++ b/src/Chapter03/Listing03.09.ArrayDeclarationWithAssignment.cs @@ -4,9 +4,11 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages = { "C#", "COBOL", "Java", "C++", "TypeScript", "Visual Basic", "Python", "Lisp", "JavaScript" }; + #endregion } } } diff --git a/src/Chapter03/Listing03.10.ArrayAssignmentFollowingDeclaration.cs b/src/Chapter03/Listing03.10.ArrayAssignmentFollowingDeclaration.cs index a71e9fefa..b8afe7c3a 100644 --- a/src/Chapter03/Listing03.10.ArrayAssignmentFollowingDeclaration.cs +++ b/src/Chapter03/Listing03.10.ArrayAssignmentFollowingDeclaration.cs @@ -4,10 +4,12 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages; - languages = new string[] { "C#", "COBOL", "Java", + languages = new string[]{ "C#", "COBOL", "Java", "C++", "TypeScript", "Visual Basic", "Python", "Lisp", "JavaScript" }; + #endregion } } } diff --git a/src/Chapter03/Listing03.11.ArrayAssignmentWithNewDuringDeclaration.cs b/src/Chapter03/Listing03.11.ArrayAssignmentWithNewDuringDeclaration.cs index 733929cba..14f3cd938 100644 --- a/src/Chapter03/Listing03.11.ArrayAssignmentWithNewDuringDeclaration.cs +++ b/src/Chapter03/Listing03.11.ArrayAssignmentWithNewDuringDeclaration.cs @@ -4,10 +4,12 @@ public class Program { public static void Main() { - string[] languages = new string[] { + #region INCLUDE + string[] languages = new string[]{ "C#", "COBOL", "Java", "C++", "TypeScript", "Visual Basic", "Python", "Lisp", "JavaScript" }; + #endregion } } } diff --git a/src/Chapter03/Listing03.12.DeclarationAndAssignmentWithTheNewKeyword.cs b/src/Chapter03/Listing03.12.DeclarationAndAssignmentWithTheNewKeyword.cs index d9cad152e..b41b2ea01 100644 --- a/src/Chapter03/Listing03.12.DeclarationAndAssignmentWithTheNewKeyword.cs +++ b/src/Chapter03/Listing03.12.DeclarationAndAssignmentWithTheNewKeyword.cs @@ -4,10 +4,12 @@ public class Program { public static void Main() { - string[] languages = new string[9] { + #region INCLUDE + string[] languages = new string[9]{ "C#", "COBOL", "Java", "C++", "TypeScript", "Visual Basic", "Python", "Lisp", "JavaScript" }; + #endregion } } } diff --git a/src/Chapter03/Listing03.13.AssigningWithoutLiteralValues.cs b/src/Chapter03/Listing03.13.AssigningWithoutLiteralValues.cs index 83cf482e0..9e3f45c52 100644 --- a/src/Chapter03/Listing03.13.AssigningWithoutLiteralValues.cs +++ b/src/Chapter03/Listing03.13.AssigningWithoutLiteralValues.cs @@ -4,7 +4,9 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages = new string[9]; + #endregion } } } diff --git a/src/Chapter03/Listing03.14.DefiningTheArraySizeAtRuntime.cs b/src/Chapter03/Listing03.14.DefiningTheArraySizeAtRuntime.cs index 3dfd8aade..7d7289f22 100644 --- a/src/Chapter03/Listing03.14.DefiningTheArraySizeAtRuntime.cs +++ b/src/Chapter03/Listing03.14.DefiningTheArraySizeAtRuntime.cs @@ -4,11 +4,13 @@ public class Program { public static void Main() { + #region INCLUDE string[] groceryList; System.Console.Write("How many items on the list? "); int size = int.Parse(System.Console.ReadLine()); groceryList = new string[size]; // ... + #endregion } } } diff --git a/src/Chapter03/Listing03.15.DeclaringATwoDimensionalArray.cs b/src/Chapter03/Listing03.15.DeclaringATwoDimensionalArray.cs index 342eeafe7..41848a5a7 100644 --- a/src/Chapter03/Listing03.15.DeclaringATwoDimensionalArray.cs +++ b/src/Chapter03/Listing03.15.DeclaringATwoDimensionalArray.cs @@ -4,7 +4,9 @@ public class Program { public static void Main() { + #region INCLUDE int[,] cells = new int[3,3]; + #endregion } } } diff --git a/src/Chapter03/Listing03.16.InitializingATwoDimensionalArrayOfIntegers.cs b/src/Chapter03/Listing03.16.InitializingATwoDimensionalArrayOfIntegers.cs index 6c9180ba1..80f11ba22 100644 --- a/src/Chapter03/Listing03.16.InitializingATwoDimensionalArrayOfIntegers.cs +++ b/src/Chapter03/Listing03.16.InitializingATwoDimensionalArrayOfIntegers.cs @@ -4,11 +4,13 @@ public class Program { public static void Main() { + #region INCLUDE int[,] cells = { {1, 0, 2}, {1, 2, 0}, {1, 2, 1} }; + #endregion } } } diff --git a/src/Chapter03/Listing03.17.AMultidimensionalArrayWithInconsistentSizeCausingAnError.cs b/src/Chapter03/Listing03.17.AMultidimensionalArrayWithInconsistentSizeCausingAnError.cs index 61930df64..b71012a46 100644 --- a/src/Chapter03/Listing03.17.AMultidimensionalArrayWithInconsistentSizeCausingAnError.cs +++ b/src/Chapter03/Listing03.17.AMultidimensionalArrayWithInconsistentSizeCausingAnError.cs @@ -4,15 +4,21 @@ public class Program { public static void Main() { + #region INCLUDE // ERROR: Each dimension must be consistently sized + #region EXCLUDE /* + #endregion int[,] cells = { {1, 0, 2, 0}, {1, 2, 0}, {1, 2}, {1} }; + #region EXCLUDE */ + #endregion + #endregion } } } diff --git a/src/Chapter03/Listing03.18.InitializingAThreeDimensionalArray.cs b/src/Chapter03/Listing03.18.InitializingAThreeDimensionalArray.cs index e57e24dec..0f744ed4c 100644 --- a/src/Chapter03/Listing03.18.InitializingAThreeDimensionalArray.cs +++ b/src/Chapter03/Listing03.18.InitializingAThreeDimensionalArray.cs @@ -4,22 +4,34 @@ public class Program { public static void Main() { + #region INCLUDE bool[, ,] cells; - cells = new bool[2, 3, 3] + cells = new bool[2, 3, 3] { - // Player 1 moves - { // X | | - {true, false, false}, // ---+---+--- - {true, false, false}, // X | | - {true, false, true} // ---+---+--- - }, // X | | X - // Player 2 moves - { // | | O - {false, false, true}, // ---+---+--- - {false, true, false}, // | O | - {false, true, true} // ---+---+--- - } // | O | + // Player 1 moves + // X | | + // ---+---+--- + // X | | + // ---+---+--- + // X | | X + { + {true, false, false}, + {true, false, false}, + {true, false, true} + }, + // Player 2 moves + // | | O + // ---+---+--- + // | O | + // ---+---+--- + // | O | + { + {false, false, true}, + {false, true, false}, + {false, true, true} + } }; + #endregion } } } diff --git a/src/Chapter03/Listing03.19.InitializingAJaggedArray.cs b/src/Chapter03/Listing03.19.InitializingAJaggedArray.cs index f925cf048..6a47f73ea 100644 --- a/src/Chapter03/Listing03.19.InitializingAJaggedArray.cs +++ b/src/Chapter03/Listing03.19.InitializingAJaggedArray.cs @@ -4,12 +4,14 @@ public class Program { public static void Main() { + #region INCLUDE int[][] cells = { new int[] {1, 0, 2, 0}, new int[] {1, 2, 0}, new int[] {1, 2}, new int[] {1} }; + #endregion } } } diff --git a/src/Chapter03/Listing03.20.DeclaringAndAccessingAnArray.cs b/src/Chapter03/Listing03.20.DeclaringAndAccessingAnArray.cs index e94f61a1f..d8226a68e 100644 --- a/src/Chapter03/Listing03.20.DeclaringAndAccessingAnArray.cs +++ b/src/Chapter03/Listing03.20.DeclaringAndAccessingAnArray.cs @@ -4,18 +4,20 @@ public class Program { public static void Main() { - string[] languages = new string[] { + #region INCLUDE + string[] languages = new string[9]{ "C#", "COBOL", "Java", "C++", "TypeScript", "Visual Basic", "Python", "Lisp", "JavaScript"}; // Retrieve fifth item in languages array (TypeScript) string language = languages[4]; - // Write �TypeScript� + // Write "TypeScript" System.Console.WriteLine(language); // Retrieve second item from the end (Python) language = languages[^3]; - // Write �Python� + // Write "Python" System.Console.WriteLine(language); + #endregion } } } diff --git a/src/Chapter03/Listing03.21.SwappingDataBetweenPositionsInAnArray.cs b/src/Chapter03/Listing03.21.SwappingDataBetweenPositionsInAnArray.cs index 32bf9ae37..136592208 100644 --- a/src/Chapter03/Listing03.21.SwappingDataBetweenPositionsInAnArray.cs +++ b/src/Chapter03/Listing03.21.SwappingDataBetweenPositionsInAnArray.cs @@ -4,6 +4,7 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages = new string[] { "C#", "COBOL", "Java", "C++", "TypeScript", "Visual Basic", @@ -14,6 +15,7 @@ public static void Main() languages[3] = languages[2]; // Assign language to location of "Java" languages[2] = language; + #endregion } } } diff --git a/src/Chapter03/Listing03.22.InitializingATwoDimensionalArrayOfIntegers.cs b/src/Chapter03/Listing03.22.InitializingATwoDimensionalArrayOfIntegers.cs index 548514bd5..15e4731ac 100644 --- a/src/Chapter03/Listing03.22.InitializingATwoDimensionalArrayOfIntegers.cs +++ b/src/Chapter03/Listing03.22.InitializingATwoDimensionalArrayOfIntegers.cs @@ -4,6 +4,7 @@ public class Program { public static void Main() { + #region INCLUDE int[,] cells = { {1, 0, 2}, {0, 2, 0}, @@ -11,6 +12,7 @@ public static void Main() }; // Set the winning tic-tac-toe move to be player 1 cells[1, 0] = 1; + #endregion } } } diff --git a/src/Chapter03/Listing03.23.DeclaringAJaggedArray.cs b/src/Chapter03/Listing03.23.DeclaringAJaggedArray.cs index 9a1b4aa20..67249d0f2 100644 --- a/src/Chapter03/Listing03.23.DeclaringAJaggedArray.cs +++ b/src/Chapter03/Listing03.23.DeclaringAJaggedArray.cs @@ -4,14 +4,16 @@ public class Program { public static void Main() { + #region INCLUDE int[][] cells = { - new int[] {1, 0, 2}, - new int[] {0, 2, 0}, - new int[] {1, 2, 1} + new int[]{1, 0, 2}, + new int[]{0, 2, 0}, + new int[]{1, 2, 1} }; cells[1][0] = 1; // ... + #endregion } } } diff --git a/src/Chapter03/Listing03.24.RetrievingTheLengthOfAnArray.cs b/src/Chapter03/Listing03.24.RetrievingTheLengthOfAnArray.cs index 6fdc4830a..ae43764f2 100644 --- a/src/Chapter03/Listing03.24.RetrievingTheLengthOfAnArray.cs +++ b/src/Chapter03/Listing03.24.RetrievingTheLengthOfAnArray.cs @@ -6,8 +6,10 @@ public static void Main() { string[] languages = new string[9]; // ... + #region INCLUDE System.Console.WriteLine( $"There are {languages.Length} languages in the array."); + #endregion } } } diff --git a/src/Chapter03/Listing03.25.AccessingOutsideTheBoundsOfAnArrayThrowingAnException.cs b/src/Chapter03/Listing03.25.AccessingOutsideTheBoundsOfAnArrayThrowingAnException.cs index 90f3b22f9..ebd816732 100644 --- a/src/Chapter03/Listing03.25.AccessingOutsideTheBoundsOfAnArrayThrowingAnException.cs +++ b/src/Chapter03/Listing03.25.AccessingOutsideTheBoundsOfAnArrayThrowingAnException.cs @@ -4,11 +4,13 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages = new string[9]; // ... // RUNTIME ERROR: index out of bounds - should // be 8 for the last element languages[4] = languages[9]; + #endregion } } } diff --git a/src/Chapter03/Listing03.26.UsingLengthMinus1InTheArrayIndex.cs b/src/Chapter03/Listing03.26.UsingLengthMinus1InTheArrayIndex.cs index 7eee5b945..dd3662412 100644 --- a/src/Chapter03/Listing03.26.UsingLengthMinus1InTheArrayIndex.cs +++ b/src/Chapter03/Listing03.26.UsingLengthMinus1InTheArrayIndex.cs @@ -6,9 +6,11 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages = new string[9]; // ... languages[4] = languages[languages.Length - 1]; + #endregion } } } diff --git a/src/Chapter03/Listing03.27.Slicing.cs b/src/Chapter03/Listing03.27.Slicing.cs index 4b912987b..f53d49f99 100644 --- a/src/Chapter03/Listing03.27.Slicing.cs +++ b/src/Chapter03/Listing03.27.Slicing.cs @@ -4,6 +4,7 @@ public class Program { public static void Main() { + #region INCLUDE string[] languages = new string[] { "C#", "COBOL", "Java", "C++", "TypeScript", "Swift", @@ -32,6 +33,7 @@ public static void Main() // C#, COBOL, Java, C++, TypeScript, Swift, Python, Lisp, JavaScript string.Join(", ", languages[0..^0]) // Python, Lisp, JavaScript }"); + #endregion } } } diff --git a/src/Chapter03/Listing03.28.AdditionalArrayMethods.cs b/src/Chapter03/Listing03.28.AdditionalArrayMethods.cs index 31390a1f7..b98037d33 100644 --- a/src/Chapter03/Listing03.28.AdditionalArrayMethods.cs +++ b/src/Chapter03/Listing03.28.AdditionalArrayMethods.cs @@ -1,5 +1,6 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_28 { + #region INCLUDE public class ProgrammingLanguages { public static void Main() @@ -9,11 +10,15 @@ public static void Main() "C++", "TypeScript", "Swift", "Python", "Lisp", "JavaScript"}; + #region HIGHLIGHT System.Array.Sort(languages); + #endregion string searchString = "COBOL"; + #region HIGHLIGHT int index = System.Array.BinarySearch( languages, searchString); + #endregion System.Console.WriteLine( "The wave of the future, " + $"{ searchString }, is at index { index }."); @@ -25,17 +30,22 @@ public static void Main() $"{ "-------------",-20 }\t{ "------------",-20 }"); System.Console.WriteLine( $"{ languages[0],-20 }\t{ languages[^1],-20 }"); + #region HIGHLIGHT System.Array.Reverse(languages); + #endregion System.Console.WriteLine( $"{ languages[0],-20 }\t{ languages[^1],-20 }"); // Note this does not remove all items from the array // Rather it sets each item to the type's default value + #region HIGHLIGHT System.Array.Clear(languages, 0, languages.Length); + #endregion System.Console.WriteLine( $"{ languages[0],-20 }\t{ languages[^1],-20 }"); System.Console.WriteLine( $"After clearing, the array size is: { languages.Length }"); } } + #endregion } diff --git a/src/Chapter03/Listing03.29.RetrievingAParticularDimensionsSize.cs b/src/Chapter03/Listing03.29.RetrievingAParticularDimensionsSize.cs index d54e582e2..9bcc66807 100644 --- a/src/Chapter03/Listing03.29.RetrievingAParticularDimensionsSize.cs +++ b/src/Chapter03/Listing03.29.RetrievingAParticularDimensionsSize.cs @@ -4,10 +4,12 @@ public class Program { public static void Main() { + #region INCLUDE bool[, ,] cells; cells = new bool[2, 3, 3]; - System.Console.WriteLine(cells.GetLength(0)); // Displays 2 - System.Console.WriteLine(cells.Rank); // Displays 3 + System.Console.WriteLine(cells.GetLength(0)); // Displays 2 + System.Console.WriteLine(cells.Rank); // Displays 3 + #endregion } } } diff --git a/src/Chapter03/Listing03.30.LookingForCommandlineOptions.cs b/src/Chapter03/Listing03.30.LookingForCommandlineOptions.cs index 0d24a4bdc..8e0ab3d59 100644 --- a/src/Chapter03/Listing03.30.LookingForCommandlineOptions.cs +++ b/src/Chapter03/Listing03.30.LookingForCommandlineOptions.cs @@ -2,6 +2,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_30 { public class Program { + #region INCLUDE public static void Main(string[] args) { // ... @@ -10,5 +11,6 @@ public static void Main(string[] args) // This parameter is an option } } + #endregion } } diff --git a/src/Chapter03/Listing03.31.LookingForCommandlineOptionsSimplified.cs b/src/Chapter03/Listing03.31.LookingForCommandlineOptionsSimplified.cs index aedaf51aa..cbd168f97 100644 --- a/src/Chapter03/Listing03.31.LookingForCommandlineOptionsSimplified.cs +++ b/src/Chapter03/Listing03.31.LookingForCommandlineOptionsSimplified.cs @@ -2,6 +2,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_31 { public class Program { + #region INCLUDE public static void Main(string[] args) { // ... @@ -11,5 +12,6 @@ public static void Main(string[] args) // This parameter is an option } } + #endregion } } diff --git a/src/Chapter03/Listing03.32.ReversingAString.cs b/src/Chapter03/Listing03.32.ReversingAString.cs index 2db5fd2ac..3198974bb 100644 --- a/src/Chapter03/Listing03.32.ReversingAString.cs +++ b/src/Chapter03/Listing03.32.ReversingAString.cs @@ -1,5 +1,6 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_32 { + #region INCLUDE public class Palindrome { public static void Main() @@ -14,11 +15,15 @@ public static void Main() reverse = palindrome.Replace(" ", ""); reverse = reverse.ToLower(); + #region HIGHLIGHT // Convert to an array temp = reverse.ToCharArray(); + #endregion + #region HIGHLIGHT // Reverse the array System.Array.Reverse(temp); + #endregion // Convert the array back to a string and // check if reverse string is the same @@ -34,4 +39,5 @@ public static void Main() } } } + #endregion }