Add regions to chapter 11
MODIFY
src/Chapter11/Listing11.04.CreatingCustomException.cs
src/Chapter11/Listing11.04.CreatingCustomException.cs
@@ -3,7 +3,7 @@ using System.Runtime.Serialization;
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_04
{
-
+ #region INCLUDE
class DatabaseException : Exception
{
public DatabaseException(
@@ -39,7 +39,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_04
{
// ...
}
-
+ #region EXCLUDE
// Used for deserialization of exceptions
public DatabaseException(
SerializationInfo serializationInfo,
@@ -48,7 +48,9 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_04
{
//...
}
+ #endregion EXCLUDE
}
+ #endregion INCLUDE
// Create mock versions of the database exception classes rather
// than referencing the real libraries.

MODIFY
src/Chapter11/Listing11.05.DefiningASerializableException.cs
src/Chapter11/Listing11.05.DefiningASerializableException.cs
@@ -3,9 +3,14 @@ using System.Runtime.Serialization;
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_05
{
-
+ #region INCLUDE
+ // Supporting serialization via an attribute
+ #region HIGHLIGHT
+ [Serializable]
+ #endregion HIGHLIGHT
class DatabaseException : Exception
{
+ #region EXCLUDE
public DatabaseException(
string? message,
System.Data.SqlClient.SQLException? exception)
@@ -39,16 +44,20 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_05
{
// ...
}
+ #endregion EXCLUDE
// Used for deserialization of exceptions
public DatabaseException(
+ #region HIGHLIGHT
SerializationInfo serializationInfo,
StreamingContext context)
: base(serializationInfo, context)
+ #endregion HIGHLIGHT
{
//...
}
}
+ #endregion INCLUDE
// Create mock versions of the database exception classes rather
// than referencing the real libraries.

MODIFY
src/Chapter11/Listing11.06.OverflowingAnIntegerValue.cs
src/Chapter11/Listing11.06.OverflowingAnIntegerValue.cs
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_06
{
+ #region INCLUDE
+ using System;
public class Program
{
public static void Main()
@@ -7,8 +9,8 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_06
// int.MaxValue equals 2147483647
int n = int.MaxValue;
n = n + 1;
- System.Console.WriteLine(n);
+ Console.WriteLine(n);
}
}
-
+ #endregion INCLUDE
}

MODIFY
src/Chapter11/Listing11.07.ACheckedBlockExample.cs
src/Chapter11/Listing11.07.ACheckedBlockExample.cs
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_07
{
+ #region INCLUDE
+ using System;
public class Program
{
public static void Main()
{
+ #region HIGHLIGHT
checked
{
+ #endregion HIGHLIGHT
// int.MaxValue equals 2147483647
int n = int.MaxValue;
n = n + 1;
- System.Console.WriteLine(n);
+ Console.WriteLine(n);
+ #region HIGHLIGHT
}
+ #endregion HIGHLIGHT
}
}
+ #endregion INCLUDE
}

MODIFY
src/Chapter11/Listing11.08.AnUnCheckedBlockExample.cs
src/Chapter11/Listing11.08.AnUnCheckedBlockExample.cs
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_08
{
+ #region INCLUDE
+ using System;
public class Program
{
public static void Main()
{
+ #region HIGHLIGHT
unchecked
{
+ #endregion HIGHLIGHT
// int.MaxValue equals 2147483647
int n = int.MaxValue;
n = n + 1;
- System.Console.WriteLine(n);
+ Console.WriteLine(n);
+ #region HIGHLIGHT
}
+ #endregion HIGHLIGHT
}
}
+ #endregion INCLUDE
}

Add regions to chapter 11