diff --git a/9781590598221.jpg b/9781590598221.jpg
new file mode 100644
index 0000000..d56a426
Binary files /dev/null and b/9781590598221.jpg differ
diff --git a/Code/Chapter 1/Calc.cs b/Code/Chapter 1/Calc.cs
new file mode 100644
index 0000000..911b212
--- /dev/null
+++ b/Code/Chapter 1/Calc.cs
@@ -0,0 +1,26 @@
+// Calc.cs
+using System;
+
+namespace CalculatorExample
+{
+ // This class contains the app's entry point.
+ public class Program
+ {
+ static void Main()
+ {
+ Calc c = new Calc();
+ int ans = c.Add(10, 84);
+ Console.WriteLine("10 + 84 is {0}.", ans);
+
+ // Wait for user to press the Enter key before shutting down.
+ Console.ReadLine();
+ }
+ }
+
+ // The C# calculator.
+ public class Calc
+ {
+ public int Add(int x, int y)
+ { return x + y; }
+ }
+}
diff --git a/Code/Chapter 1/Calc.vb b/Code/Chapter 1/Calc.vb
new file mode 100644
index 0000000..697c4f5
--- /dev/null
+++ b/Code/Chapter 1/Calc.vb
@@ -0,0 +1,21 @@
+' Calc.vb
+Imports System
+
+Namespace CalculatorExample
+ ' A VB .NET 'Module' is a class that only contains
+ ' static members.
+ Module Program
+ Sub Main()
+ Dim c As New Calc
+ Dim ans As Integer = c.Add(10, 84)
+ Console.WriteLine("10 + 84 is {0}.", ans)
+ Console.ReadLine()
+ End Sub
+ End Module
+
+ Class Calc
+ Public Function Add(ByVal x As Integer, ByVal y As Integer) As Integer
+ Return x + y
+ End Function
+ End Class
+End Namespace
diff --git a/Code/Chapter 1/ReadMe.txt b/Code/Chapter 1/ReadMe.txt
new file mode 100644
index 0000000..f8bd46d
--- /dev/null
+++ b/Code/Chapter 1/ReadMe.txt
@@ -0,0 +1,8 @@
+These files have been provided simply
+because they were mentioned in Chapter 1.
+
+However, Chapter 2 explains how to compile
+VB source code. If you want to compile Calc.vb
+code into a .NET executable, check out Ch. 2.
+
+- Andrew
\ No newline at end of file
diff --git a/Code/Chapter 10/Boxing/Boxing.sln b/Code/Chapter 10/Boxing/Boxing.sln
new file mode 100644
index 0000000..3988576
--- /dev/null
+++ b/Code/Chapter 10/Boxing/Boxing.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Boxing", "Boxing.vbproj", "{6106329D-4867-4612-AB9C-689998AFEE8D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6106329D-4867-4612-AB9C-689998AFEE8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6106329D-4867-4612-AB9C-689998AFEE8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6106329D-4867-4612-AB9C-689998AFEE8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6106329D-4867-4612-AB9C-689998AFEE8D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/Boxing/Boxing.suo b/Code/Chapter 10/Boxing/Boxing.suo
new file mode 100644
index 0000000..1dead89
Binary files /dev/null and b/Code/Chapter 10/Boxing/Boxing.suo differ
diff --git a/Code/Chapter 10/Boxing/Boxing.vbproj b/Code/Chapter 10/Boxing/Boxing.vbproj
new file mode 100644
index 0000000..9c56499
--- /dev/null
+++ b/Code/Chapter 10/Boxing/Boxing.vbproj
@@ -0,0 +1,134 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {6106329D-4867-4612-AB9C-689998AFEE8D}
+ Exe
+ Boxing.Program
+ Boxing
+ Boxing
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ Boxing.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ Boxing.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/Boxing/Boxing.vbproj.user b/Code/Chapter 10/Boxing/Boxing.vbproj.user
new file mode 100644
index 0000000..26d4d5b
--- /dev/null
+++ b/Code/Chapter 10/Boxing/Boxing.vbproj.user
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+ ProjectFiles
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/Boxing/My Project/Application.Designer.vb b/Code/Chapter 10/Boxing/My Project/Application.Designer.vb
new file mode 100644
index 0000000..bf69971
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1434
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/Boxing/My Project/Application.myapp b/Code/Chapter 10/Boxing/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/Boxing/My Project/AssemblyInfo.vb b/Code/Chapter 10/Boxing/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..c6b9a19
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/Boxing/My Project/Resources.Designer.vb b/Code/Chapter 10/Boxing/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..9d03e5c
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1434
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Boxing.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/Boxing/My Project/Resources.resx b/Code/Chapter 10/Boxing/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/Boxing/My Project/Settings.Designer.vb b/Code/Chapter 10/Boxing/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..d3b6f10
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1434
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.Boxing.My.MySettings
+ Get
+ Return Global.Boxing.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/Boxing/My Project/Settings.settings b/Code/Chapter 10/Boxing/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/Boxing/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/Boxing/Program.vb b/Code/Chapter 10/Boxing/Program.vb
new file mode 100644
index 0000000..f25cd7f
--- /dev/null
+++ b/Code/Chapter 10/Boxing/Program.vb
@@ -0,0 +1,52 @@
+Option Explicit On
+Option Strict On
+
+' Structures are value types!
+Structure MyPoint
+ Public x, y As Integer
+End Structure
+
+Module Program
+
+ Sub Main()
+ Console.WriteLine("***** Fun with Boxing / Unboxing *****")
+ Console.WriteLine()
+
+ ' Make a short value type.
+ Dim s As Short = 25
+
+ ' Because s is passed into a
+ ' method prototyped to take an Object,
+ ' it is 'boxed' automatically.
+ UseThisObject(s)
+
+ Dim myData As New ArrayList()
+ myData.Add(88)
+ myData.Add(3.33)
+ myData.Add(False)
+
+ ' Unbox first item from ArrayList.
+ Dim firstItem As Integer = CType(myData(0), Integer)
+ Console.WriteLine("First item is {0} ", firstItem)
+
+ Dim p As MyPoint
+ p.x = 10
+ p.y = 20
+ UseBoxedMyPoint(p)
+
+ Console.ReadLine()
+ End Sub
+
+ Sub UseThisObject(ByVal o As Object)
+ Console.WriteLine("Value of o is: {0} ", o)
+ End Sub
+
+ Sub UseBoxedMyPoint(ByVal o As Object)
+ ' Error! System.Object does not have
+ ' member variables named 'x' or 'y'.
+ If TypeOf o Is MyPoint Then
+ Dim p As MyPoint = CType(o, MyPoint)
+ Console.WriteLine("{0}, {1}", p.x, p.y)
+ End If
+ End Sub
+End Module
diff --git a/Code/Chapter 10/CollectionTypes/Car.vb b/Code/Chapter 10/CollectionTypes/Car.vb
new file mode 100644
index 0000000..ebc309f
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/Car.vb
@@ -0,0 +1,104 @@
+Option Explicit On
+Option Strict On
+
+Public Class Car
+ Implements IComparable
+
+ ' Constant for maximum speed.
+ Public Const maxSpeed As Integer = 100
+
+ 'Internal state data.
+ Private currSpeed As Integer
+ Private petName As String
+ Private carID As Integer
+
+ 'Is the car still operational?
+ Private carIsDead As Boolean
+
+ 'A car has a radio.
+ Private theMusicBox As Radio = New Radio
+
+#Region "Properties & constructors"
+ ' Properties.
+ Public Property Name() As String
+ Get
+ Return petName
+ End Get
+ Set(ByVal value As String)
+ petName = value
+ End Set
+ End Property
+ Public Property Speed() As Integer
+ Get
+ Return currSpeed
+ End Get
+ Set(ByVal value As Integer)
+ currSpeed = value
+ End Set
+ End Property
+ Public Property ID() As Integer
+ Get
+ Return carID
+ End Get
+ Set(ByVal value As Integer)
+ carID = value
+ End Set
+ End Property
+
+ ' Constructors.
+ Public Sub New()
+ End Sub
+ Public Sub New(ByVal name As String, ByVal currSp As Integer, ByVal id As Integer)
+ currSpeed = currSp
+ petName = name
+ carID = id
+ End Sub
+#End Region
+
+ Public Sub CrankTunes(ByVal state As Boolean)
+ theMusicBox.TurnOn(state)
+ End Sub
+
+ ' See if Car has overheated.
+ Public Sub Accelerate(ByVal delta As Integer)
+ If carIsDead Then
+ Console.WriteLine("{0} is out of order...", petName)
+ Else
+ currSpeed += delta
+ If currSpeed >= maxSpeed Then
+ carIsDead = True
+ currSpeed = 0
+
+ ' We need to call the HelpLink property, thus we need to
+ ' create a local variable before throwing the Exception object.
+ Dim ex As New Exception(String.Format("{0} has overheated!", petName))
+ ex.HelpLink = "http://www.CarsRUs.com"
+ ' Stuff in custom data regarding the error.
+ ex.Data.Add("TimeStamp", _
+ String.Format("The car exploded at {0} ", DateTime.Now))
+ ex.Data.Add("Cause", "You have a lead foot.")
+ Throw ex
+ Else
+ Console.WriteLine("=> CurrSpeed = {0} ", currSpeed)
+ End If
+ End If
+ End Sub
+
+ Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo
+ Dim temp As Car = CType(obj, Car)
+ If Me.carID > temp.carID Then
+ Return 1
+ End If
+ If Me.carID < temp.carID Then
+ Return -1
+ Else
+ Return 0
+ End If
+ End Function
+
+ Public Shared ReadOnly Property SortByPetName() As IComparer
+ Get
+ Return CType(New PetNameComparer(), IComparer)
+ End Get
+ End Property
+End Class
\ No newline at end of file
diff --git a/Code/Chapter 10/CollectionTypes/CollectionTypes.sln b/Code/Chapter 10/CollectionTypes/CollectionTypes.sln
new file mode 100644
index 0000000..309ad5a
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/CollectionTypes.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CollectionTypes", "CollectionTypes.vbproj", "{13AF3C0E-433A-4DB1-BC39-2395E1207D7F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {13AF3C0E-433A-4DB1-BC39-2395E1207D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {13AF3C0E-433A-4DB1-BC39-2395E1207D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {13AF3C0E-433A-4DB1-BC39-2395E1207D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {13AF3C0E-433A-4DB1-BC39-2395E1207D7F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/CollectionTypes/CollectionTypes.suo b/Code/Chapter 10/CollectionTypes/CollectionTypes.suo
new file mode 100644
index 0000000..de93f9f
Binary files /dev/null and b/Code/Chapter 10/CollectionTypes/CollectionTypes.suo differ
diff --git a/Code/Chapter 10/CollectionTypes/CollectionTypes.vbproj b/Code/Chapter 10/CollectionTypes/CollectionTypes.vbproj
new file mode 100644
index 0000000..b784c07
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/CollectionTypes.vbproj
@@ -0,0 +1,112 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {13AF3C0E-433A-4DB1-BC39-2395E1207D7F}
+ Exe
+ CollectionTypes.Program
+ CollectionTypes
+ CollectionTypes
+ 512
+ Console
+ v3.5
+ On
+ Binary
+ Off
+ On
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ CollectionTypes.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ CollectionTypes.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/CollectionTypes/My Project/Application.Designer.vb b/Code/Chapter 10/CollectionTypes/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/CollectionTypes/My Project/Application.myapp b/Code/Chapter 10/CollectionTypes/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/CollectionTypes/My Project/AssemblyInfo.vb b/Code/Chapter 10/CollectionTypes/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..68f3060
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/CollectionTypes/My Project/Resources.Designer.vb b/Code/Chapter 10/CollectionTypes/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..2c02509
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '
+ ' A strongly-typed resource class, for looking up localized strings, etc.
+ '
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '
+ ' Returns the cached ResourceManager instance used by this class.
+ '
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CollectionTypes.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '
+ ' Overrides the current thread's CurrentUICulture property for all
+ ' resource lookups using this strongly typed resource class.
+ '
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/CollectionTypes/My Project/Resources.resx b/Code/Chapter 10/CollectionTypes/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/CollectionTypes/My Project/Settings.Designer.vb b/Code/Chapter 10/CollectionTypes/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..8d6d095
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.CollectionTypes.My.MySettings
+ Get
+ Return Global.CollectionTypes.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/CollectionTypes/My Project/Settings.settings b/Code/Chapter 10/CollectionTypes/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/CollectionTypes/PetNameComparer.vb b/Code/Chapter 10/CollectionTypes/PetNameComparer.vb
new file mode 100644
index 0000000..487f77d
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/PetNameComparer.vb
@@ -0,0 +1,13 @@
+Imports System.Collections
+
+Public Class PetNameComparer
+ Implements IComparer
+
+ Public Sub New()
+ End Sub
+ Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
+ Dim t1 As Car = CType(x, Car)
+ Dim t2 As Car = CType(y, Car)
+ Return String.Compare(t1.Name, t2.Name)
+ End Function
+End Class
diff --git a/Code/Chapter 10/CollectionTypes/Program.vb b/Code/Chapter 10/CollectionTypes/Program.vb
new file mode 100644
index 0000000..fa8f458
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/Program.vb
@@ -0,0 +1,102 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+
+ Sub Main()
+ Console.WriteLine("***** Fun with System.Collections *****" & vbLf)
+ ArrayListTest()
+ Console.WriteLine()
+ QueueTest()
+ Console.WriteLine()
+ StackTest()
+ Console.ReadLine()
+ End Sub
+
+#Region "ArrayList Test"
+ Sub ArrayListTest()
+ ' Make ArrayList and add a range of Cars.
+ Dim carArList As New ArrayList()
+ carArList.AddRange(New Car() {New Car("Fred", 90, 10), _
+ New Car("Mary", 100, 50), New Car("MB", 190, 11)})
+ Console.WriteLine("Items in carArList: {0}", carArList.Count)
+
+ ' Iterate over contents using For / Each.
+ For Each c As Car In carArList
+ Console.WriteLine("Car pet name: {0}", c.Name)
+ Next
+
+ ' Insert new car.
+ Console.WriteLine("->Inserting new Car.")
+ carArList.Insert(2, New Car("TheNewCar", 0, 12))
+ Console.WriteLine("Items in carArList: {0}", carArList.Count)
+
+ ' Get the subobjects as an array.
+ Dim arrayOfCars As Object() = carArList.ToArray()
+ Dim i As Integer = 0
+
+ ' Now iterate over array using While loop / Length property.
+ While i < arrayOfCars.Length
+ Console.WriteLine("Car pet name: {0}", CType(arrayOfCars(i), Car).Name)
+ i = i + 1
+ End While
+ End Sub
+
+#End Region
+
+#Region "Queue Test"
+ Public Sub WashCar(ByVal c As Car)
+ Console.WriteLine("Cleaning {0}", c.Name)
+ End Sub
+
+ Sub QueueTest()
+ ' Make a Q with three items.
+ Dim carWashQ As New Queue()
+ carWashQ.Enqueue(New Car("FirstCar", 0, 1))
+ carWashQ.Enqueue(New Car("SecondCar", 0, 2))
+ carWashQ.Enqueue(New Car("ThirdCar", 0, 3))
+
+ ' Peek at first car in Q.
+ Console.WriteLine("First in Q is {0}", _
+ CType(carWashQ.Peek(), Car).Name)
+
+ ' Remove each item from Q.
+ WashCar(CType(carWashQ.Dequeue(), Car))
+ WashCar(CType(carWashQ.Dequeue(), Car))
+ WashCar(CType(carWashQ.Dequeue(), Car))
+
+ ' Try to de-Q again?
+ Try
+ WashCar(CType(carWashQ.Dequeue(), Car))
+ Catch ex As Exception
+ Console.WriteLine("Error!! {0}", ex.Message)
+ End Try
+ End Sub
+#End Region
+
+#Region "Stack Test"
+ Sub StackTest()
+ Dim stringStack As New Stack()
+ stringStack.Push("One")
+ stringStack.Push("Two")
+ stringStack.Push("Three")
+
+ ' Now look at the top item, pop it, and look again.
+ Console.WriteLine("Top item is: {0}", stringStack.Peek())
+ Console.WriteLine("Popped off {0}", stringStack.Pop())
+ Console.WriteLine("Top item is: {0}", stringStack.Peek())
+ Console.WriteLine("Popped off {0}", stringStack.Pop())
+ Console.WriteLine("Top item is: {0}", stringStack.Peek())
+ Console.WriteLine("Popped off {0}", stringStack.Pop())
+
+ Try
+ Console.WriteLine("Top item is: {0} ", stringStack.Peek())
+ Console.WriteLine("Popped off {0} ", stringStack.Pop())
+ Catch ex As Exception
+ Console.WriteLine("Error!! {0} ", ex.Message)
+ End Try
+ End Sub
+
+#End Region
+
+End Module
diff --git a/Code/Chapter 10/CollectionTypes/Radio.vb b/Code/Chapter 10/CollectionTypes/Radio.vb
new file mode 100644
index 0000000..1bfec88
--- /dev/null
+++ b/Code/Chapter 10/CollectionTypes/Radio.vb
@@ -0,0 +1,13 @@
+Option Explicit On
+Option Strict On
+
+Public Class Radio
+ Public Sub TurnOn(ByVal state As Boolean)
+ If state = True Then
+ Console.WriteLine("Jamming...")
+ Else
+ Console.WriteLine("Quiet time...")
+ End If
+ End Sub
+End Class
+
diff --git a/Code/Chapter 10/CustomGenericCollection/CarCollection.vb b/Code/Chapter 10/CustomGenericCollection/CarCollection.vb
new file mode 100644
index 0000000..ba9cc35
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/CarCollection.vb
@@ -0,0 +1,45 @@
+Option Explicit On
+Option Strict On
+
+Public Class CarCollection(Of T As Car)
+ Implements IEnumerable(Of T)
+
+ Private myCars As New List(Of T)
+
+ ' Error! System.Object does not have a
+ ' property named PetName.
+ Public Sub PrintPetName(ByVal pos As Integer)
+ Console.WriteLine(myCars(pos).PetName)
+ End Sub
+
+ ' Type indexer.
+ Default Public Property Item(ByVal index As Integer) As T
+ Get
+ Return myCars(index)
+ End Get
+ Set(ByVal value As T)
+ myCars.Add(value)
+ End Set
+ End Property
+
+ Public Sub ClearCars()
+ myCars.Clear()
+ End Sub
+
+ Public Function CarCount() As Integer
+ Return myCars.Count()
+ End Function
+
+#Region "Interface implementations"
+ Public Function GetEnumeratorGeneric() As IEnumerator(Of T) _
+ Implements IEnumerable(Of T).GetEnumerator
+ Return myCars.GetEnumerator()
+ End Function
+
+ Public Function GetEnumerator() As IEnumerator _
+ Implements IEnumerable.GetEnumerator
+ Return myCars.GetEnumerator()
+ End Function
+#End Region
+
+End Class
diff --git a/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.sln b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.sln
new file mode 100644
index 0000000..c016d0c
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CustomGenericCollection", "CustomGenericCollection.vbproj", "{08AC02C1-15A2-4BB6-AA86-790A6785673A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {08AC02C1-15A2-4BB6-AA86-790A6785673A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {08AC02C1-15A2-4BB6-AA86-790A6785673A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {08AC02C1-15A2-4BB6-AA86-790A6785673A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {08AC02C1-15A2-4BB6-AA86-790A6785673A}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.suo b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.suo
new file mode 100644
index 0000000..e643d2a
Binary files /dev/null and b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.suo differ
diff --git a/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.vbproj b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.vbproj
new file mode 100644
index 0000000..4b73cbb
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.vbproj
@@ -0,0 +1,137 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {08AC02C1-15A2-4BB6-AA86-790A6785673A}
+ Exe
+ CustomGenericCollection.Program
+ CustomGenericCollection
+ CustomGenericCollection
+ Console
+
+
+ 2.0
+
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+ v3.5
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ CustomGenericCollection.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ CustomGenericCollection.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.vbproj.user b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.vbproj.user
new file mode 100644
index 0000000..97e11c3
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/CustomGenericCollection.vbproj.user
@@ -0,0 +1,17 @@
+
+
+ ProjectFiles
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/CustomGenericCollection/ExampleConstraints.vb b/Code/Chapter 10/CustomGenericCollection/ExampleConstraints.vb
new file mode 100644
index 0000000..4b4b0ed
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/ExampleConstraints.vb
@@ -0,0 +1,31 @@
+Option Explicit On
+Option Strict On
+
+' Contained items must have a default ctor.
+Public Class MyGenericClass(Of T As New)
+End Class
+
+' Contained items must implement ICloneable
+' and support a default ctor.
+Public Class MyGenericClass2(Of T As {ICloneable, New})
+End Class
+
+' MyGenericClass derives from SomBaseClass and implements ISomeInterface,
+' while the contained items must be structures.
+Public Class MyGenericClass3(Of T As Structure)
+ Inherits SomeBaseClass
+ Implements ISomeInterface
+End Class
+
+' (Of K) must have a default ctor, while (Of T) must
+' implement the generic IComparable interface.
+Public Class MyGenericClass(Of K As New, T As IComparable(Of T))
+End Class
+
+#Region "Just so the previous code compiles..."
+Public Class SomeBaseClass
+End Class
+
+Public Interface ISomeInterface
+End Interface
+#End Region
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/Application.Designer.vb b/Code/Chapter 10/CustomGenericCollection/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/Application.myapp b/Code/Chapter 10/CustomGenericCollection/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/AssemblyInfo.vb b/Code/Chapter 10/CustomGenericCollection/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..ece720b
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/Resources.Designer.vb b/Code/Chapter 10/CustomGenericCollection/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..bd81d07
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CustomGenericCollection.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/Resources.resx b/Code/Chapter 10/CustomGenericCollection/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/Settings.Designer.vb b/Code/Chapter 10/CustomGenericCollection/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..83aa75e
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.CustomGenericCollection.My.MySettings
+ Get
+ Return Global.CustomGenericCollection.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/CustomGenericCollection/My Project/Settings.settings b/Code/Chapter 10/CustomGenericCollection/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/CustomGenericCollection/Program.vb b/Code/Chapter 10/CustomGenericCollection/Program.vb
new file mode 100644
index 0000000..21f5838
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/Program.vb
@@ -0,0 +1,29 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Custom Generic Collection *****")
+ Console.WriteLine()
+
+ ' Make a collection of Cars.
+ Dim myCars As New CarCollection(Of Car)
+ myCars(0) = New Car("Rusty", 20)
+ myCars(1) = New Car("Zippy", 90)
+
+ For Each c As Car In myCars
+ Console.WriteLine("PetName: {0} , Speed: {1} ", _
+ c.PetName, c.Speed)
+ Next
+
+ Console.WriteLine()
+
+ Dim otherCars As New CarCollection(Of Car)
+ otherCars(0) = New MiniVan("Mel", 10)
+ otherCars(1) = New SportsCar("Suzy", 30)
+ For i As Integer = 0 To otherCars.CarCount - 1
+ otherCars.PrintPetName(i)
+ Next
+ Console.ReadLine()
+ End Sub
+End Module
diff --git a/Code/Chapter 10/CustomGenericCollection/SimpleCars.vb b/Code/Chapter 10/CustomGenericCollection/SimpleCars.vb
new file mode 100644
index 0000000..0e46760
--- /dev/null
+++ b/Code/Chapter 10/CustomGenericCollection/SimpleCars.vb
@@ -0,0 +1,29 @@
+Option Explicit On
+Option Strict On
+
+' A simple Car type for testing
+Public Class Car
+ Public PetName As String
+ Public Speed As Integer
+ Public Sub New(ByVal name As String, ByVal sp As Integer)
+ PetName = name : Speed = sp
+ End Sub
+ Public Sub New()
+ End Sub
+End Class
+
+Public Class SportsCar
+ Inherits Car
+ Public Sub New(ByVal p As String, ByVal s As Integer)
+ MyBase.New(p, s)
+ End Sub
+ ' Assume additional SportsCar methods.
+End Class
+
+Public Class MiniVan
+ Inherits Car
+ Public Sub New(ByVal p As String, ByVal s As Integer)
+ MyBase.New(p, s)
+ End Sub
+ ' Assume additional MiniVan methods.
+End Class
diff --git a/Code/Chapter 10/GenericDelegate/GenericDelegate.sln b/Code/Chapter 10/GenericDelegate/GenericDelegate.sln
new file mode 100644
index 0000000..8ef7295
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/GenericDelegate.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GenericDelegate", "GenericDelegate.vbproj", "{EA004E11-FF3F-43BD-BB64-404DCE200AF8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EA004E11-FF3F-43BD-BB64-404DCE200AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EA004E11-FF3F-43BD-BB64-404DCE200AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EA004E11-FF3F-43BD-BB64-404DCE200AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EA004E11-FF3F-43BD-BB64-404DCE200AF8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/GenericDelegate/GenericDelegate.suo b/Code/Chapter 10/GenericDelegate/GenericDelegate.suo
new file mode 100644
index 0000000..141cc18
Binary files /dev/null and b/Code/Chapter 10/GenericDelegate/GenericDelegate.suo differ
diff --git a/Code/Chapter 10/GenericDelegate/GenericDelegate.vbproj b/Code/Chapter 10/GenericDelegate/GenericDelegate.vbproj
new file mode 100644
index 0000000..9303ca0
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/GenericDelegate.vbproj
@@ -0,0 +1,134 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {EA004E11-FF3F-43BD-BB64-404DCE200AF8}
+ Exe
+ GenericDelegate.Program
+ GenericDelegate
+ GenericDelegate
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ GenericDelegate.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ GenericDelegate.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericDelegate/GenericDelegate.vbproj.user b/Code/Chapter 10/GenericDelegate/GenericDelegate.vbproj.user
new file mode 100644
index 0000000..97e11c3
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/GenericDelegate.vbproj.user
@@ -0,0 +1,17 @@
+
+
+ ProjectFiles
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericDelegate/My Project/Application.Designer.vb b/Code/Chapter 10/GenericDelegate/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/GenericDelegate/My Project/Application.myapp b/Code/Chapter 10/GenericDelegate/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/GenericDelegate/My Project/AssemblyInfo.vb b/Code/Chapter 10/GenericDelegate/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..81801a0
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/GenericDelegate/My Project/Resources.Designer.vb b/Code/Chapter 10/GenericDelegate/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..42b525c
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GenericDelegate.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericDelegate/My Project/Resources.resx b/Code/Chapter 10/GenericDelegate/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericDelegate/My Project/Settings.Designer.vb b/Code/Chapter 10/GenericDelegate/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..1445d02
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.GenericDelegate.My.MySettings
+ Get
+ Return Global.GenericDelegate.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericDelegate/My Project/Settings.settings b/Code/Chapter 10/GenericDelegate/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/GenericDelegate/Program.vb b/Code/Chapter 10/GenericDelegate/Program.vb
new file mode 100644
index 0000000..9d2dfc3
--- /dev/null
+++ b/Code/Chapter 10/GenericDelegate/Program.vb
@@ -0,0 +1,62 @@
+Option Explicit On
+Option Strict On
+
+' This generic delegate can point to any method
+' taking a single argument (specified at the time
+' of creation).
+Public Delegate Sub MyGenericDelegate(Of T)(ByVal arg As T)
+
+#Region "Simulating generic delegates with Object."
+Public Delegate Sub MyDelegate(ByVal arg As Object)
+
+Module NonGenericDelegateTest
+ Sub TestMethod()
+ ' Register target with 'traditional' delegate syntax.
+ Dim d As New MyDelegate(AddressOf MyTarget)
+ d("More string data")
+
+ ' Register target using method group conversion.
+ Dim d2 As New MyDelegate(AddressOf MyTarget)
+ d2(9) ' Boxing penalty!
+ End Sub
+
+ ' Due to a lack of type safety, we must
+ ' determine the underlying type before casting.
+ Sub MyTarget(ByVal arg As Object)
+ If TypeOf arg Is Integer Then
+ Dim i As Integer = CType(arg, Integer) ' Unboxing penalty!
+ Console.WriteLine("++arg is: {0}", ++i)
+ End If
+ If TypeOf arg Is String Then
+ Dim s As String = CType(arg, String)
+ Console.WriteLine("arg in uppercase is: {0}", s.ToUpper())
+ End If
+ End Sub
+End Module
+#End Region
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Fun with generic delegates *****")
+ Console.WriteLine()
+
+ ' Make instance of delegate pointing to method taking an
+ ' integer.
+ Dim d As New MyGenericDelegate(Of Integer)(AddressOf IntegerTarget)
+ d(100)
+
+ ' Now pointing to a method taking a string.
+ Dim d2 As New MyGenericDelegate(Of String)(AddressOf StringTarget)
+ d2("Cool!")
+ End Sub
+
+ Public Sub IntegerTarget(ByVal arg As Integer)
+ Console.WriteLine("You passed me a {0} with the value of {1}", _
+ arg.GetType().Name, arg)
+ End Sub
+
+ Public Sub StringTarget(ByVal arg As String)
+ Console.WriteLine("You passed me a {0} with the value of {1}", _
+ arg.GetType().Name, arg)
+ End Sub
+End Module
diff --git a/Code/Chapter 10/GenericInterface/GenericInterface.sln b/Code/Chapter 10/GenericInterface/GenericInterface.sln
new file mode 100644
index 0000000..9291376
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/GenericInterface.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GenericInterface", "GenericInterface.vbproj", "{4E436B31-4279-48BD-BB6E-603F6AC5C7E2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4E436B31-4279-48BD-BB6E-603F6AC5C7E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4E436B31-4279-48BD-BB6E-603F6AC5C7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4E436B31-4279-48BD-BB6E-603F6AC5C7E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4E436B31-4279-48BD-BB6E-603F6AC5C7E2}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/GenericInterface/GenericInterface.suo b/Code/Chapter 10/GenericInterface/GenericInterface.suo
new file mode 100644
index 0000000..da9957a
Binary files /dev/null and b/Code/Chapter 10/GenericInterface/GenericInterface.suo differ
diff --git a/Code/Chapter 10/GenericInterface/GenericInterface.vbproj b/Code/Chapter 10/GenericInterface/GenericInterface.vbproj
new file mode 100644
index 0000000..022020a
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/GenericInterface.vbproj
@@ -0,0 +1,134 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {4E436B31-4279-48BD-BB6E-603F6AC5C7E2}
+ Exe
+ GenericInterface.Program
+ GenericInterface
+ GenericInterface
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ GenericInterface.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ GenericInterface.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericInterface/GenericInterface.vbproj.user b/Code/Chapter 10/GenericInterface/GenericInterface.vbproj.user
new file mode 100644
index 0000000..97e11c3
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/GenericInterface.vbproj.user
@@ -0,0 +1,17 @@
+
+
+ ProjectFiles
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericInterface/My Project/Application.Designer.vb b/Code/Chapter 10/GenericInterface/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/GenericInterface/My Project/Application.myapp b/Code/Chapter 10/GenericInterface/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/GenericInterface/My Project/AssemblyInfo.vb b/Code/Chapter 10/GenericInterface/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..25e4e52
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/GenericInterface/My Project/Resources.Designer.vb b/Code/Chapter 10/GenericInterface/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..1fe2daf
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GenericInterface.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericInterface/My Project/Resources.resx b/Code/Chapter 10/GenericInterface/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericInterface/My Project/Settings.Designer.vb b/Code/Chapter 10/GenericInterface/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..c49377c
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.GenericInterface.My.MySettings
+ Get
+ Return Global.GenericInterface.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericInterface/My Project/Settings.settings b/Code/Chapter 10/GenericInterface/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/GenericInterface/Program.vb b/Code/Chapter 10/GenericInterface/Program.vb
new file mode 100644
index 0000000..df76a70
--- /dev/null
+++ b/Code/Chapter 10/GenericInterface/Program.vb
@@ -0,0 +1,44 @@
+Option Explicit On
+Option Strict On
+
+#Region "Generic interface and implementation class"
+Public Interface IBasicMath(Of T)
+ Function Add(ByVal a As T, ByVal b As T) As T
+ Function Subtract(ByVal a As T, ByVal b As T) As T
+ Function Multiply(ByVal a As T, ByVal b As T) As T
+ Function Divide(ByVal a As T, ByVal b As T) As T
+End Interface
+
+Public Class BasicMath
+ Implements IBasicMath(Of Integer)
+
+ Public Function Add(ByVal a As Integer, ByVal b As Integer) _
+ As Integer Implements IBasicMath(Of Integer).Add
+ Return a + b
+ End Function
+
+ Public Function Divide(ByVal a As Integer, ByVal b As Integer) _
+ As Integer Implements IBasicMath(Of Integer).Divide
+ Return CInt(a / b)
+ End Function
+
+ Public Function Multiply(ByVal a As Integer, ByVal b As Integer) _
+ As Integer Implements IBasicMath(Of Integer).Multiply
+ Return a * b
+ End Function
+
+ Public Function Subtract(ByVal a As Integer, ByVal b As Integer) _
+ As Integer Implements IBasicMath(Of Integer).Subtract
+ Return a - b
+ End Function
+End Class
+#End Region
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Generic Interfaces *****")
+ Dim m As New BasicMath()
+ Console.WriteLine("1 + 1 = {0} ", m.Add(1, 1))
+ Console.ReadLine()
+ End Sub
+End Module
diff --git a/Code/Chapter 10/GenericStructure/GenericStructure.sln b/Code/Chapter 10/GenericStructure/GenericStructure.sln
new file mode 100644
index 0000000..3aaa334
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/GenericStructure.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GenericStructure", "GenericStructure.vbproj", "{2693150F-59DE-4049-8206-0DE13BA28B62}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2693150F-59DE-4049-8206-0DE13BA28B62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2693150F-59DE-4049-8206-0DE13BA28B62}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2693150F-59DE-4049-8206-0DE13BA28B62}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2693150F-59DE-4049-8206-0DE13BA28B62}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/GenericStructure/GenericStructure.suo b/Code/Chapter 10/GenericStructure/GenericStructure.suo
new file mode 100644
index 0000000..cd4e4f1
Binary files /dev/null and b/Code/Chapter 10/GenericStructure/GenericStructure.suo differ
diff --git a/Code/Chapter 10/GenericStructure/GenericStructure.vbproj b/Code/Chapter 10/GenericStructure/GenericStructure.vbproj
new file mode 100644
index 0000000..5b73753
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/GenericStructure.vbproj
@@ -0,0 +1,135 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {2693150F-59DE-4049-8206-0DE13BA28B62}
+ Exe
+ GenericStructure.Program
+ GenericStructure
+ GenericStructure
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ GenericStructure.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ GenericStructure.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericStructure/GenericStructure.vbproj.user b/Code/Chapter 10/GenericStructure/GenericStructure.vbproj.user
new file mode 100644
index 0000000..97e11c3
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/GenericStructure.vbproj.user
@@ -0,0 +1,17 @@
+
+
+ ProjectFiles
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericStructure/My Project/Application.Designer.vb b/Code/Chapter 10/GenericStructure/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/GenericStructure/My Project/Application.myapp b/Code/Chapter 10/GenericStructure/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/GenericStructure/My Project/AssemblyInfo.vb b/Code/Chapter 10/GenericStructure/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..ed084fc
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/GenericStructure/My Project/Resources.Designer.vb b/Code/Chapter 10/GenericStructure/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..d48cb89
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GenericStructure.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericStructure/My Project/Resources.resx b/Code/Chapter 10/GenericStructure/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericStructure/My Project/Settings.Designer.vb b/Code/Chapter 10/GenericStructure/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..2265a71
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.GenericStructure.My.MySettings
+ Get
+ Return Global.GenericStructure.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericStructure/My Project/Settings.settings b/Code/Chapter 10/GenericStructure/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/GenericStructure/Point.vb b/Code/Chapter 10/GenericStructure/Point.vb
new file mode 100644
index 0000000..894bc85
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/Point.vb
@@ -0,0 +1,33 @@
+Option Explicit On
+Option Strict On
+
+Public Structure Point(Of T)
+ Private xPos, yPos As T
+
+ Public Sub New(ByVal x As T, ByVal y As T)
+ xPos = x : yPos = y
+ End Sub
+
+#Region "Properties for (x, y) values"
+ Public Property X() As T
+ Get
+ Return xPos
+ End Get
+ Set(ByVal value As T)
+ xPos = value
+ End Set
+ End Property
+ Public Property Y() As T
+ Get
+ Return xPos
+ End Get
+ Set(ByVal value As T)
+ yPos = value
+ End Set
+ End Property
+#End Region
+
+ Public Overrides Function ToString() As String
+ Return String.Format("({0}, {1})", xPos, yPos)
+ End Function
+End Structure
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericStructure/Program.vb b/Code/Chapter 10/GenericStructure/Program.vb
new file mode 100644
index 0000000..addb99a
--- /dev/null
+++ b/Code/Chapter 10/GenericStructure/Program.vb
@@ -0,0 +1,43 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Fun with Custom Generic Types *****")
+ Console.WriteLine()
+
+ ' Make a Point Integers.
+ Dim intPt As New Point(Of Integer)(100, 100)
+ Console.WriteLine("intPt.ToString()={0} ", intPt.ToString())
+ Console.WriteLine()
+
+ ' Point using double.
+ Dim dblPt As New Point(Of Double)(5.6, 3.23)
+ Console.WriteLine("dblPt.ToString()={0} ", dblPt.ToString())
+ Console.WriteLine()
+
+ ' Swap 2 Points.
+ Dim p1 As New Point(Of Integer)(10, 43)
+ Dim p2 As New Point(Of Integer)(6, 987)
+ Console.WriteLine("Before swap: {0} , {1} ", p1, p2)
+
+ ' Here we are swapping two points of type Integer.
+ Swap(Of Point(Of Integer))(p1, p2)
+
+ ' Could also simply write the following
+ ' given type inference.
+ ' Swap(p1, p2)
+
+ Console.WriteLine("After swap: {0} , {1} ", p1, p2)
+ Console.ReadLine()
+ End Sub
+
+ ' This generic method can swap any two items of type 'T'
+ Public Function Swap(Of T)(ByRef a As T, ByRef b As T) As T
+ Console.WriteLine("T is a {0}.", GetType(T))
+ Dim temp As T
+ temp = a
+ a = b
+ b = temp
+ End Function
+End Module
diff --git a/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.sln b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.sln
new file mode 100644
index 0000000..6b31c57
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GenericSwapMethod", "GenericSwapMethod.vbproj", "{E03E5102-4B92-4518-8A6D-0DBBF08B07F8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E03E5102-4B92-4518-8A6D-0DBBF08B07F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E03E5102-4B92-4518-8A6D-0DBBF08B07F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E03E5102-4B92-4518-8A6D-0DBBF08B07F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E03E5102-4B92-4518-8A6D-0DBBF08B07F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.suo b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.suo
new file mode 100644
index 0000000..739a131
Binary files /dev/null and b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.suo differ
diff --git a/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.vbproj b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.vbproj
new file mode 100644
index 0000000..ceb22ae
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.vbproj
@@ -0,0 +1,134 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {E03E5102-4B92-4518-8A6D-0DBBF08B07F8}
+ Exe
+ GenericSwapMethod.Program
+ GenericSwapMethod
+ GenericSwapMethod
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ GenericSwapMethod.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ GenericSwapMethod.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.vbproj.user b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.vbproj.user
new file mode 100644
index 0000000..26d4d5b
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/GenericSwapMethod.vbproj.user
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+ ProjectFiles
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/Application.Designer.vb b/Code/Chapter 10/GenericSwapMethod/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/Application.myapp b/Code/Chapter 10/GenericSwapMethod/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/AssemblyInfo.vb b/Code/Chapter 10/GenericSwapMethod/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..c5ce070
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/Resources.Designer.vb b/Code/Chapter 10/GenericSwapMethod/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..5a7a214
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GenericSwapMethod.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/Resources.resx b/Code/Chapter 10/GenericSwapMethod/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/Settings.Designer.vb b/Code/Chapter 10/GenericSwapMethod/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..442439d
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.GenericSwapMethod.My.MySettings
+ Get
+ Return Global.GenericSwapMethod.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/GenericSwapMethod/My Project/Settings.settings b/Code/Chapter 10/GenericSwapMethod/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/GenericSwapMethod/Program.vb b/Code/Chapter 10/GenericSwapMethod/Program.vb
new file mode 100644
index 0000000..249fed1
--- /dev/null
+++ b/Code/Chapter 10/GenericSwapMethod/Program.vb
@@ -0,0 +1,74 @@
+Option Explicit On
+Option Strict On
+
+#Region "Non-generic members"
+Module NonGenericMethods
+ Public Function Swap(ByRef a As Integer, ByRef b As Integer) As Integer
+ Dim temp As Integer
+ temp = a
+ a = b
+ b = temp
+ End Function
+ Public Function Swap(ByRef a As Double, ByRef b As Double) As Double
+ Dim temp As Double
+ temp = a
+ a = b
+ b = temp
+ End Function
+End Module
+#End Region
+
+Module Program
+
+#Region "Generic methods"
+ ' This generic method can swap any two items of type 'T'.
+ Public Function Swap(Of T)(ByRef a As T, ByRef b As T) As T
+ Console.WriteLine("T is a {0}.", GetType(T))
+ Dim temp As T
+ temp = a
+ a = b
+ b = temp
+ End Function
+
+ ' Display the base class of 'T'.
+ Sub DisplayBaseClass(Of T)()
+ Console.WriteLine("Base class of {0} is: {1}.", _
+ GetType(T), GetType(T).BaseType)
+ End Sub
+#End Region
+
+ Sub Main()
+ Console.WriteLine("***** Fun with Generic Methods *****" & vbLf)
+
+ ' Swap two Integers.
+ Dim a, b As Integer
+ a = 10 : b = 40
+ Console.WriteLine("Before swap: a={0}, b={1}", a, b)
+ Swap(Of Integer)(a, b)
+ Console.WriteLine("After swap: a={0}, b={1}", a, b)
+ Console.WriteLine()
+
+ ' Swap two Strings.
+ Dim s1, s2 As String
+ s1 = "Generics" : s2 = "Rock"
+ Console.WriteLine("Before swap: s1={0}, s2={1}", s1, s2)
+ Swap(Of String)(s1, s2)
+ Console.WriteLine("After swap: s1={0}, s2={1}", s1, s2)
+ Console.WriteLine()
+
+ ' Compiler will infer System.Boolean.
+ Dim b1, b2 As Boolean
+ b1 = True : b2 = False
+ Console.WriteLine("Before swap: b1={0}, b2={1}", b1, b2)
+ Swap(b1, b2)
+ Console.WriteLine("Before swap: b1={0}, b2={1}", b1, b2)
+ Console.WriteLine()
+
+ ' Must specify 'T' when a generic
+ ' method takes no parameters.
+ DisplayBaseClass(Of Boolean)()
+ DisplayBaseClass(Of String)()
+ DisplayBaseClass(Of Integer)()
+ Console.ReadLine()
+ End Sub
+End Module
diff --git a/Code/Chapter 10/NullableData/My Project/Application.Designer.vb b/Code/Chapter 10/NullableData/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/NullableData/My Project/Application.myapp b/Code/Chapter 10/NullableData/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/NullableData/My Project/AssemblyInfo.vb b/Code/Chapter 10/NullableData/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..56816d9
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/NullableData/My Project/Resources.Designer.vb b/Code/Chapter 10/NullableData/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..d8c41ad
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("NullableData.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/NullableData/My Project/Resources.resx b/Code/Chapter 10/NullableData/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/NullableData/My Project/Settings.Designer.vb b/Code/Chapter 10/NullableData/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..7bc48f7
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.NullableData.My.MySettings
+ Get
+ Return Global.NullableData.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/NullableData/My Project/Settings.settings b/Code/Chapter 10/NullableData/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/NullableData/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/NullableData/NullableData.sln b/Code/Chapter 10/NullableData/NullableData.sln
new file mode 100644
index 0000000..a3f6b60
--- /dev/null
+++ b/Code/Chapter 10/NullableData/NullableData.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NullableData", "NullableData.vbproj", "{0E8206B7-765B-45EB-80A2-0CC6CB922CC7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0E8206B7-765B-45EB-80A2-0CC6CB922CC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0E8206B7-765B-45EB-80A2-0CC6CB922CC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0E8206B7-765B-45EB-80A2-0CC6CB922CC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0E8206B7-765B-45EB-80A2-0CC6CB922CC7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/NullableData/NullableData.suo b/Code/Chapter 10/NullableData/NullableData.suo
new file mode 100644
index 0000000..5bab480
Binary files /dev/null and b/Code/Chapter 10/NullableData/NullableData.suo differ
diff --git a/Code/Chapter 10/NullableData/NullableData.vbproj b/Code/Chapter 10/NullableData/NullableData.vbproj
new file mode 100644
index 0000000..6aea4d5
--- /dev/null
+++ b/Code/Chapter 10/NullableData/NullableData.vbproj
@@ -0,0 +1,134 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {0E8206B7-765B-45EB-80A2-0CC6CB922CC7}
+ Exe
+ NullableData.Program
+ NullableData
+ NullableData
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ NullableData.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ NullableData.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/NullableData/NullableData.vbproj.user b/Code/Chapter 10/NullableData/NullableData.vbproj.user
new file mode 100644
index 0000000..97e11c3
--- /dev/null
+++ b/Code/Chapter 10/NullableData/NullableData.vbproj.user
@@ -0,0 +1,17 @@
+
+
+ ProjectFiles
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/NullableData/Program.vb b/Code/Chapter 10/NullableData/Program.vb
new file mode 100644
index 0000000..1c087c5
--- /dev/null
+++ b/Code/Chapter 10/NullableData/Program.vb
@@ -0,0 +1,89 @@
+Option Explicit On
+Option Strict On
+
+#Region "Helper classes"
+'Class DatabaseReader
+' ' Nullable data fields.
+' Public numericValue As Nullable(Of Integer)
+' Public boolValue As Nullable(Of Boolean) = True
+
+' ' Note the nullable return type.
+' Public Function GetIntFromDatabase() As Nullable(Of Integer)
+' Return numericValue
+' End Function
+
+' ' Note the nullable return type.
+' Public Function GetBoolFromDatabase() As Nullable(Of Boolean)
+' Return boolValue
+' End Function
+'End Class
+
+Class DatabaseReader
+ ' Note the use of the ? operator in the class
+ ' definition.
+ Public numericValue As Integer?
+ Public boolValue As Boolean? = True
+
+ ' Note the nullable return type.
+ Public Function GetIntFromDatabase() As Integer?
+ Return numericValue
+ End Function
+
+ ' Note the nullable return type.
+ Public Function GetBoolFromDatabase() As Boolean?
+ Return boolValue
+ End Function
+End Class
+#End Region
+
+Module Program
+
+ Sub Main()
+ Console.WriteLine("***** Fun with Nullable Data *****" & vbLf)
+ Dim dr As New DatabaseReader()
+
+ ' Get int from 'database'.
+ Dim i As Integer? = dr.GetIntFromDatabase()
+ If (i.HasValue) Then
+ Console.WriteLine("Value of 'i' is: {0}", i.Value)
+ Else
+ Console.WriteLine("Value of 'i' is undefined.")
+ End If
+
+ ' Get bool from 'database'.
+ Dim b As Boolean? = dr.GetBoolFromDatabase()
+ If (b.HasValue) Then
+ Console.WriteLine("Value of 'b' is: {0}", b.Value)
+ Else
+ Console.WriteLine("Value of 'b' is undefined.")
+ End If
+
+ Console.ReadLine()
+ End Sub
+
+#Region "Main with Nullable (Of T)"
+ 'Sub Main()
+ ' Console.WriteLine("***** Fun with Nullable Data *****")
+ ' Console.WriteLine()
+ ' Dim dr As New DatabaseReader()
+
+ ' ' Get int from 'database'.
+ ' Dim i As Nullable(Of Integer) = dr.GetIntFromDatabase()
+ ' If (i.HasValue) Then
+ ' Console.WriteLine("Value of 'i' is: {0}", i.Value)
+ ' Else
+ ' Console.WriteLine("Value of 'i' is undefined.")
+ ' End If
+
+ ' ' Get bool from 'database'.
+ ' Dim b As Nullable(Of Boolean) = dr.GetBoolFromDatabase()
+ ' If (b.HasValue) Then
+ ' Console.WriteLine("Value of 'b' is: {0}", b.Value)
+ ' Else
+ ' Console.WriteLine("Value of 'b' is undefined.")
+ ' End If
+ ' Console.ReadLine()
+ 'End Sub
+#End Region
+
+End Module
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/Application.Designer.vb b/Code/Chapter 10/SimpleGenerics/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/Application.myapp b/Code/Chapter 10/SimpleGenerics/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/AssemblyInfo.vb b/Code/Chapter 10/SimpleGenerics/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..7a0613e
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/Resources.Designer.vb b/Code/Chapter 10/SimpleGenerics/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..31a00ff
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SimpleGenerics.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/Resources.resx b/Code/Chapter 10/SimpleGenerics/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/Settings.Designer.vb b/Code/Chapter 10/SimpleGenerics/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..971c962
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.SimpleGenerics.My.MySettings
+ Get
+ Return Global.SimpleGenerics.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/SimpleGenerics/My Project/Settings.settings b/Code/Chapter 10/SimpleGenerics/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/SimpleGenerics/Program.vb b/Code/Chapter 10/SimpleGenerics/Program.vb
new file mode 100644
index 0000000..c446292
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/Program.vb
@@ -0,0 +1,28 @@
+Option Explicit On
+Option Strict On
+
+Public Class Car
+End Class
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** This example does not do much beyond showing *****")
+ Console.WriteLine("***** how to declare a generic type *****")
+ Console.WriteLine()
+
+ ' A list of Cars.
+ Dim myCars As New List(Of Car)
+ myCars.Add(New Car())
+ Console.WriteLine("myCars contains {0} items", _
+ myCars.Count)
+
+ ' A list of Integers.
+ Dim MyInts As New List(Of Integer)
+ MyInts.Add(50)
+ ' No unboxing!
+ Dim val As Integer = MyInts.Count
+ Console.WriteLine("myInts contains {0} items", MyInts.Count)
+ Console.ReadLine()
+ End Sub
+End Module
+
diff --git a/Code/Chapter 10/SimpleGenerics/SimpleGenerics.sln b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.sln
new file mode 100644
index 0000000..29ff854
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SimpleGenerics", "SimpleGenerics.vbproj", "{1BFBC666-99B9-40B4-96AA-104434CCE728}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1BFBC666-99B9-40B4-96AA-104434CCE728}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1BFBC666-99B9-40B4-96AA-104434CCE728}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1BFBC666-99B9-40B4-96AA-104434CCE728}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1BFBC666-99B9-40B4-96AA-104434CCE728}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/SimpleGenerics/SimpleGenerics.suo b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.suo
new file mode 100644
index 0000000..f007442
Binary files /dev/null and b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.suo differ
diff --git a/Code/Chapter 10/SimpleGenerics/SimpleGenerics.vbproj b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.vbproj
new file mode 100644
index 0000000..c50aec5
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.vbproj
@@ -0,0 +1,134 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {1BFBC666-99B9-40B4-96AA-104434CCE728}
+ Exe
+ SimpleGenerics.Program
+ SimpleGenerics
+ SimpleGenerics
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ SimpleGenerics.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ SimpleGenerics.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/SimpleGenerics/SimpleGenerics.vbproj.user b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.vbproj.user
new file mode 100644
index 0000000..fdcb14e
--- /dev/null
+++ b/Code/Chapter 10/SimpleGenerics/SimpleGenerics.vbproj.user
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+ ShowAllFiles
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/StronglyTypedCollections/Car.vb b/Code/Chapter 10/StronglyTypedCollections/Car.vb
new file mode 100644
index 0000000..b578655
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/Car.vb
@@ -0,0 +1,6 @@
+Option Explicit On
+Option Strict On
+
+' This is just to test the custom Car collection.
+Public Class Car
+End Class
diff --git a/Code/Chapter 10/StronglyTypedCollections/CarCollection.vb b/Code/Chapter 10/StronglyTypedCollections/CarCollection.vb
new file mode 100644
index 0000000..aa0d76c
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/CarCollection.vb
@@ -0,0 +1,41 @@
+Option Explicit On
+Option Strict On
+
+Public Class CarCollection
+ Implements IEnumerable
+ Private arCars As New ArrayList()
+
+ Public Function GetCar(ByVal pos As Integer) As Car
+ Return CType(arCars(pos), Car)
+ End Function
+
+ Public Sub AddCar(ByVal c As Car)
+ arCars.Add(c)
+ End Sub
+
+ Public Sub ClearCars()
+ arCars.Clear()
+ End Sub
+
+ Public ReadOnly Property Count() As Integer
+ Get
+ Return arCars.Count
+ End Get
+ End Property
+
+ Public Function GetEnumerator() As IEnumerator _
+ Implements IEnumerable.GetEnumerator
+ Return arCars.GetEnumerator()
+ End Function
+
+ ' The 'indexer' of this custom collection.
+ Default Public Property Item(ByVal c As Integer) As Car
+ Get
+ Return CType(arCars(c), Car)
+ End Get
+ Set(ByVal value As Car)
+ arCars.Insert(c, value)
+ End Set
+ End Property
+
+End Class
diff --git a/Code/Chapter 10/StronglyTypedCollections/IntegerCollection.vb b/Code/Chapter 10/StronglyTypedCollections/IntegerCollection.vb
new file mode 100644
index 0000000..577d564
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/IntegerCollection.vb
@@ -0,0 +1,41 @@
+Option Explicit On
+Option Strict On
+
+Public Class IntegerCollection
+ Implements IEnumerable
+
+ Private arInts As New ArrayList()
+
+ Public Function GetInt(ByVal pos As Integer) As Integer
+ Return CType(arInts(pos), Integer)
+ End Function
+
+ Public Sub AddInt(ByVal i As Integer)
+ arInts.Add(i)
+ End Sub
+
+ Public Sub ClearInts()
+ arInts.Clear()
+ End Sub
+
+ Public ReadOnly Property Count() As Integer
+ Get
+ Return arInts.Count
+ End Get
+ End Property
+
+ Public Function GetEnumerator() As IEnumerator _
+ Implements IEnumerable.GetEnumerator
+ Return arInts.GetEnumerator()
+ End Function
+
+ ' The 'indexer' of this custom collection.
+ Default Public Property Item(ByVal c As Integer) As Integer
+ Get
+ Return CType(arInts(c), Integer)
+ End Get
+ Set(ByVal value As Integer)
+ arInts.Insert(c, value)
+ End Set
+ End Property
+End Class
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/Application.Designer.vb b/Code/Chapter 10/StronglyTypedCollections/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/Application.myapp b/Code/Chapter 10/StronglyTypedCollections/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/AssemblyInfo.vb b/Code/Chapter 10/StronglyTypedCollections/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..c5b6855
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/Resources.Designer.vb b/Code/Chapter 10/StronglyTypedCollections/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..c1d6ea4
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("StronglyTypedCollections.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/Resources.resx b/Code/Chapter 10/StronglyTypedCollections/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/Settings.Designer.vb b/Code/Chapter 10/StronglyTypedCollections/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..211a3a9
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.StronglyTypedCollections.My.MySettings
+ Get
+ Return Global.StronglyTypedCollections.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 10/StronglyTypedCollections/My Project/Settings.settings b/Code/Chapter 10/StronglyTypedCollections/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 10/StronglyTypedCollections/PeopleCollection.vb b/Code/Chapter 10/StronglyTypedCollections/PeopleCollection.vb
new file mode 100644
index 0000000..37766f8
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/PeopleCollection.vb
@@ -0,0 +1,41 @@
+Option Explicit On
+Option Strict On
+
+Public Class PeopleCollection
+ Implements IEnumerable
+ Private arPeople As New ArrayList()
+
+ Public Function GetPerson(ByVal pos As Integer) As Person
+ Return CType(arPeople(pos), Person)
+ End Function
+
+ Public Sub AddPerson(ByVal p As Person)
+ arPeople.Add(p)
+ End Sub
+
+ Public Sub ClearPeople()
+ arPeople.Clear()
+ End Sub
+
+ Public ReadOnly Property Count() As Integer
+ Get
+ Return arPeople.Count
+ End Get
+ End Property
+
+ Public Function GetEnumerator() As IEnumerator _
+ Implements IEnumerable.GetEnumerator
+ Return arPeople.GetEnumerator()
+ End Function
+
+ ' The 'indexer' of this custom collection.
+ Default Public Property Item(ByVal p As Integer) As Person
+ Get
+ Return CType(arPeople(p), Person)
+ End Get
+ Set(ByVal value As Person)
+ arPeople.Insert(p, value)
+ End Set
+ End Property
+
+End Class
diff --git a/Code/Chapter 10/StronglyTypedCollections/Person.vb b/Code/Chapter 10/StronglyTypedCollections/Person.vb
new file mode 100644
index 0000000..f66684f
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/Person.vb
@@ -0,0 +1,22 @@
+Option Explicit On
+Option Strict On
+
+Public Class Person
+ ' Made public for simplicity.
+ Public currAge As Integer
+ Public fName As String
+ Public lName As String
+
+ Public Sub New()
+ End Sub
+ Public Sub New(ByVal firstName As String, ByVal lastName As String, _
+ ByVal age As Integer)
+ currAge = age
+ fName = firstName
+ lName = lastName
+ End Sub
+
+ Public Overrides Function ToString() As String
+ Return String.Format("{0}, {1} is {2} years old.", lName, fName, currAge)
+ End Function
+End Class
diff --git a/Code/Chapter 10/StronglyTypedCollections/Program.vb b/Code/Chapter 10/StronglyTypedCollections/Program.vb
new file mode 100644
index 0000000..b03dc30
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/Program.vb
@@ -0,0 +1,43 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Strongly Typed Collections *****")
+ Console.WriteLine()
+
+ Dim myPeople As New PeopleCollection()
+ myPeople.AddPerson(New Person("Homer", "Simpson", 40))
+ myPeople.AddPerson(New Person("Marge", "Simpson", 38))
+ myPeople.AddPerson(New Person("Lisa", "Simpson", 9))
+ myPeople.AddPerson(New Person("Bart", "Simpson", 7))
+ myPeople.AddPerson(New Person("Maggie", "Simpson", 2))
+
+ ' This would be a compile-time error!
+ ' Uncomment line below to test.
+ ' myPeople.AddPerson(New Car)
+
+ For Each p As Person In myPeople
+ Console.WriteLine(p)
+ Next
+
+ ' Use the generic List type to hold only people.
+ Dim morePeople As New List(Of Person)
+ morePeople.Add(New Person())
+
+ ' Use the generic List type to hold only cars.
+ Dim moreCars As New List(Of Car)
+ moreCars.Add(New Car())
+
+ ' Compile-time error!
+ ' Uncomment line below to test.
+ ' moreCars.Add(New Person())
+
+ ' Get / Set new Person object using type indexer.
+ myPeople(5) = New Person("Waylon", "Smithers", 47)
+ Console.WriteLine("Person #5 is {0}", myPeople(5))
+
+ Console.ReadLine()
+
+ End Sub
+End Module
diff --git a/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.sln b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.sln
new file mode 100644
index 0000000..771f98a
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "StronglyTypedCollections", "StronglyTypedCollections.vbproj", "{961B843C-AC0E-4F47-9BB2-5C8A274D08BA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {961B843C-AC0E-4F47-9BB2-5C8A274D08BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {961B843C-AC0E-4F47-9BB2-5C8A274D08BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {961B843C-AC0E-4F47-9BB2-5C8A274D08BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {961B843C-AC0E-4F47-9BB2-5C8A274D08BA}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.suo b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.suo
new file mode 100644
index 0000000..993be17
Binary files /dev/null and b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.suo differ
diff --git a/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.vbproj b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.vbproj
new file mode 100644
index 0000000..566ef7e
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.vbproj
@@ -0,0 +1,139 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {961B843C-AC0E-4F47-9BB2-5C8A274D08BA}
+ Exe
+ StronglyTypedCollections.Program
+ StronglyTypedCollections
+ StronglyTypedCollections
+ Console
+
+
+ 2.0
+
+
+ v3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ StronglyTypedCollections.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ StronglyTypedCollections.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.vbproj.user b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.vbproj.user
new file mode 100644
index 0000000..97e11c3
--- /dev/null
+++ b/Code/Chapter 10/StronglyTypedCollections/StronglyTypedCollections.vbproj.user
@@ -0,0 +1,17 @@
+
+
+ ProjectFiles
+
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarDelegate/Car.vb b/Code/Chapter 11/CarDelegate/Car.vb
new file mode 100644
index 0000000..09f70bc
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/Car.vb
@@ -0,0 +1,79 @@
+Option Explicit On
+Option Strict On
+
+Public Class Car
+ ' Our delegate type.
+ Public Delegate Sub CarDelegateHandler(ByVal msg As String)
+
+ ' Because delegates are simply classes, we can create
+ ' member variables.
+ Private almostDeadList As CarDelegateHandler
+ Private explodedList As CarDelegateHandler
+
+#Region "Registration / unregistration methods"
+ ' Now with type-safe multicasting!
+ Public Sub OnAboutToBlow(ByVal clientMethod As CarDelegateHandler)
+ almostDeadList = CType(System.Delegate.Combine(almostDeadList, _
+ clientMethod), CarDelegateHandler)
+ End Sub
+ Public Sub OnExploded(ByVal clientMethod As CarDelegateHandler)
+ explodedList = CType(System.Delegate.Combine(explodedList, _
+ clientMethod), CarDelegateHandler)
+ End Sub
+
+ ' To remove a target from the list.
+ Public Sub RemoveAboutToBlow(ByVal clientMethod As CarDelegateHandler)
+ almostDeadList = CType(System.Delegate.Remove(almostDeadList, _
+ clientMethod), CarDelegateHandler)
+ End Sub
+
+ Public Sub RemoveExploded(ByVal clientMethod As CarDelegateHandler)
+ explodedList = CType(System.Delegate.Remove(explodedList, _
+ clientMethod), CarDelegateHandler)
+ End Sub
+#End Region
+
+ ' Constant for maximum speed.
+ Public Const maxSpeed As Integer = 100
+
+ 'Internal state data.
+ Private currSpeed As Integer
+ Private petName As String
+
+ 'Is the car still operational?
+ Private carIsDead As Boolean
+
+ 'A car has a radio.
+ Private theMusicBox As Radio = New Radio
+
+ ' Constructors.
+ Public Sub New()
+ End Sub
+ Public Sub New(ByVal name As String, ByVal currSp As Integer)
+ currSpeed = currSp
+ petName = name
+ End Sub
+
+ Public Sub CrankTunes(ByVal state As Boolean)
+ theMusicBox.TurnOn(state)
+ End Sub
+
+ ' See if Car has overheated.
+ Public Sub Accelerate(ByVal delta As Integer)
+ If carIsDead Then
+ If explodedList IsNot Nothing Then
+ explodedList("Sorry, this car is dead...")
+ End If
+ Else
+ currSpeed += delta
+ If 10 = maxSpeed - currSpeed AndAlso almostDeadList IsNot Nothing Then
+ almostDeadList("Careful buddy! Gonna blow!")
+ End If
+ If currSpeed >= maxSpeed Then
+ carIsDead = True
+ Else
+ Console.WriteLine("->CurrSpeed = {0} ", currSpeed)
+ End If
+ End If
+ End Sub
+End Class
\ No newline at end of file
diff --git a/Code/Chapter 11/CarDelegate/CarDelegate.sln b/Code/Chapter 11/CarDelegate/CarDelegate.sln
new file mode 100644
index 0000000..9f04a8c
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/CarDelegate.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CarDelegate", "CarDelegate.vbproj", "{82805F75-D837-4E19-8DF4-36045950D9FB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {82805F75-D837-4E19-8DF4-36045950D9FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {82805F75-D837-4E19-8DF4-36045950D9FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {82805F75-D837-4E19-8DF4-36045950D9FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82805F75-D837-4E19-8DF4-36045950D9FB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 11/CarDelegate/CarDelegate.suo b/Code/Chapter 11/CarDelegate/CarDelegate.suo
new file mode 100644
index 0000000..6604b55
Binary files /dev/null and b/Code/Chapter 11/CarDelegate/CarDelegate.suo differ
diff --git a/Code/Chapter 11/CarDelegate/CarDelegate.vbproj b/Code/Chapter 11/CarDelegate/CarDelegate.vbproj
new file mode 100644
index 0000000..660aa0e
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/CarDelegate.vbproj
@@ -0,0 +1,99 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {82805F75-D837-4E19-8DF4-36045950D9FB}
+ Exe
+ CarDelegate.Program
+ CarDelegate
+ CarDelegate
+ Console
+
+
+ 2.0
+
+
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ CarDelegate.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ CarDelegate.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarDelegate/My Project/Application.Designer.vb b/Code/Chapter 11/CarDelegate/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 11/CarDelegate/My Project/Application.myapp b/Code/Chapter 11/CarDelegate/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 11/CarDelegate/My Project/AssemblyInfo.vb b/Code/Chapter 11/CarDelegate/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..8ceb0e2
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 11/CarDelegate/My Project/Resources.Designer.vb b/Code/Chapter 11/CarDelegate/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..81a5ea4
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CarDelegate.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CarDelegate/My Project/Resources.resx b/Code/Chapter 11/CarDelegate/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarDelegate/My Project/Settings.Designer.vb b/Code/Chapter 11/CarDelegate/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..cebabcd
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.CarDelegate.My.MySettings
+ Get
+ Return Global.CarDelegate.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CarDelegate/My Project/Settings.settings b/Code/Chapter 11/CarDelegate/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 11/CarDelegate/Program.vb b/Code/Chapter 11/CarDelegate/Program.vb
new file mode 100644
index 0000000..64cf276
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/Program.vb
@@ -0,0 +1,40 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Delegates as event enablers *****")
+ Dim c1 As New Car("SlugBug", 10)
+
+ ' Register multiple event handlers!
+ c1.OnAboutToBlow(AddressOf CarAboutToBlow)
+ c1.OnAboutToBlow(AddressOf CarIsAlmostDoomed)
+ c1.OnExploded(AddressOf CarExploded)
+
+ Console.WriteLine("***** Speeding up *****")
+ For i As Integer = 0 To 5
+ c1.Accelerate(20)
+ Next
+
+ ' Remove CarExploded from list.
+ c1.RemoveExploded(AddressOf CarExploded)
+
+ ' This will not fire the Exploded event.
+ For i As Integer = 0 To 5
+ c1.Accelerate(20)
+ Next
+ Console.ReadLine()
+ End Sub
+
+ Public Sub CarAboutToBlow(ByVal msg As String)
+ Console.WriteLine(msg)
+ End Sub
+
+ Public Sub CarIsAlmostDoomed(ByVal msg As String)
+ Console.WriteLine("Critical Message from Car: {0} ", msg)
+ End Sub
+
+ Public Sub CarExploded(ByVal msg As String)
+ Console.WriteLine(msg)
+ End Sub
+End Module
diff --git a/Code/Chapter 11/CarDelegate/Radio.vb b/Code/Chapter 11/CarDelegate/Radio.vb
new file mode 100644
index 0000000..4423278
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/Radio.vb
@@ -0,0 +1,12 @@
+Option Explicit On
+Option Strict On
+
+Public Class Radio
+ Public Sub TurnOn(ByVal state As Boolean)
+ If state = True Then
+ Console.WriteLine("Jamming...")
+ Else
+ Console.WriteLine("Quiet time...")
+ End If
+ End Sub
+End Class
\ No newline at end of file
diff --git a/Code/Chapter 11/CarDelegate/UpgradeLog.XML b/Code/Chapter 11/CarDelegate/UpgradeLog.XML
new file mode 100644
index 0000000..f59a70a
--- /dev/null
+++ b/Code/Chapter 11/CarDelegate/UpgradeLog.XML
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarEvent/Car.vb b/Code/Chapter 11/CarEvent/Car.vb
new file mode 100644
index 0000000..f51d8e5
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/Car.vb
@@ -0,0 +1,51 @@
+Option Explicit On
+Option Strict On
+
+Public Class Car
+ ' Constant for maximum speed.
+ Public Const maxSpeed As Integer = 100
+
+ 'Internal state data.
+ Private currSpeed As Integer
+ Private petName As String
+
+ 'Is the car still operational?
+ Private carIsDead As Boolean
+
+ 'A car has a radio.
+ Private theMusicBox As Radio = New Radio
+
+ ' This car can send these events.
+ Public Event Exploded(ByVal msg As String)
+ Public Event AboutToBlow(ByVal msg As String)
+
+ ' Constructors.
+ Public Sub New()
+ End Sub
+ Public Sub New(ByVal name As String, ByVal currSp As Integer)
+ currSpeed = currSp
+ petName = name
+ End Sub
+
+ Public Sub CrankTunes(ByVal state As Boolean)
+ theMusicBox.TurnOn(state)
+ End Sub
+
+ Public Sub Accelerate(ByVal delta As Integer)
+ If carIsDead Then
+ ' If the car is doomed, sent out the Exploded notification.
+ RaiseEvent Exploded("Sorry, this car is dead...")
+ Else
+ currSpeed += delta
+ ' Are we almost doomed? If so, send out AboutToBlow notification.
+ If 10 = maxSpeed - currSpeed Then
+ RaiseEvent AboutToBlow("Careful buddy! Gonna blow!")
+ End If
+ If currSpeed >= maxSpeed Then
+ carIsDead = True
+ Else
+ Console.WriteLine("->CurrSpeed = {0} ", currSpeed)
+ End If
+ End If
+ End Sub
+End Class
diff --git a/Code/Chapter 11/CarEvent/CarEvent.sln b/Code/Chapter 11/CarEvent/CarEvent.sln
new file mode 100644
index 0000000..3a578bc
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/CarEvent.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CarEvent", "CarEvent.vbproj", "{CE38E111-9BB0-42C3-8E5C-6EC4C8FC23C3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CE38E111-9BB0-42C3-8E5C-6EC4C8FC23C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CE38E111-9BB0-42C3-8E5C-6EC4C8FC23C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CE38E111-9BB0-42C3-8E5C-6EC4C8FC23C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CE38E111-9BB0-42C3-8E5C-6EC4C8FC23C3}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 11/CarEvent/CarEvent.suo b/Code/Chapter 11/CarEvent/CarEvent.suo
new file mode 100644
index 0000000..2bf83f5
Binary files /dev/null and b/Code/Chapter 11/CarEvent/CarEvent.suo differ
diff --git a/Code/Chapter 11/CarEvent/CarEvent.vbproj b/Code/Chapter 11/CarEvent/CarEvent.vbproj
new file mode 100644
index 0000000..67d4484
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/CarEvent.vbproj
@@ -0,0 +1,99 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {CE38E111-9BB0-42C3-8E5C-6EC4C8FC23C3}
+ Exe
+ CarEvent.Program
+ CarEvent
+ CarEvent
+ Console
+
+
+ 2.0
+
+
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ CarEvent.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ CarEvent.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarEvent/CarEvent.vbproj.user b/Code/Chapter 11/CarEvent/CarEvent.vbproj.user
new file mode 100644
index 0000000..a1d742b
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/CarEvent.vbproj.user
@@ -0,0 +1,5 @@
+
+
+ ProjectFiles
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarEvent/My Project/Application.Designer.vb b/Code/Chapter 11/CarEvent/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 11/CarEvent/My Project/Application.myapp b/Code/Chapter 11/CarEvent/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 11/CarEvent/My Project/AssemblyInfo.vb b/Code/Chapter 11/CarEvent/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..863c72c
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 11/CarEvent/My Project/Resources.Designer.vb b/Code/Chapter 11/CarEvent/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..3ef5bf5
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CarEvent.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CarEvent/My Project/Resources.resx b/Code/Chapter 11/CarEvent/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CarEvent/My Project/Settings.Designer.vb b/Code/Chapter 11/CarEvent/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..09021ba
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.CarEvent.My.MySettings
+ Get
+ Return Global.CarEvent.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CarEvent/My Project/Settings.settings b/Code/Chapter 11/CarEvent/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 11/CarEvent/Program.vb b/Code/Chapter 11/CarEvent/Program.vb
new file mode 100644
index 0000000..b91fd62
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/Program.vb
@@ -0,0 +1,25 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+ ' Declare variables 'WithEvents' to
+ ' receive the outbound events.
+ Private WithEvents c As New Car("NightRider", 50)
+
+ Sub Main()
+ Console.WriteLine("***** Fun with Events *****")
+ Console.WriteLine()
+
+ Dim i As Integer
+ For i = 0 To 5
+ c.Accelerate(10)
+ Next
+ Console.ReadLine()
+ End Sub
+
+ ' Event Handlers.
+ Public Sub MyExplodedHandler(ByVal s As String) _
+ Handles c.Exploded, c.AboutToBlow
+ Console.WriteLine(s)
+ End Sub
+End Module
\ No newline at end of file
diff --git a/Code/Chapter 11/CarEvent/Radio.vb b/Code/Chapter 11/CarEvent/Radio.vb
new file mode 100644
index 0000000..4423278
--- /dev/null
+++ b/Code/Chapter 11/CarEvent/Radio.vb
@@ -0,0 +1,12 @@
+Option Explicit On
+Option Strict On
+
+Public Class Radio
+ Public Sub TurnOn(ByVal state As Boolean)
+ If state = True Then
+ Console.WriteLine("Jamming...")
+ Else
+ Console.WriteLine("Quiet time...")
+ End If
+ End Sub
+End Class
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEvent/Car.vb b/Code/Chapter 11/CustomEvent/Car.vb
new file mode 100644
index 0000000..ee701b8
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/Car.vb
@@ -0,0 +1,32 @@
+Option Explicit On
+Option Strict On
+
+Public Class Car
+ ' This ArrayList will hold onto the delegates
+ ' sent from the caller.
+ Private arConnections As New ArrayList()
+
+ ' This event has been customized!
+ Public Custom Event EngineStart As System.EventHandler
+ AddHandler(ByVal value As EventHandler)
+ Console.WriteLine("Added connection")
+ arConnections.Add(value)
+ End AddHandler
+
+ RemoveHandler(ByVal value As System.EventHandler)
+ Console.WriteLine("Removed connection")
+ arConnections.Remove(value)
+ End RemoveHandler
+
+ RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
+ For Each h As EventHandler In arConnections
+ Console.WriteLine("Raising event")
+ h(sender, e)
+ Next
+ End RaiseEvent
+ End Event
+
+ Public Sub Start()
+ RaiseEvent EngineStart(Me, New EventArgs())
+ End Sub
+End Class
diff --git a/Code/Chapter 11/CustomEvent/CarEventArgs.vb b/Code/Chapter 11/CustomEvent/CarEventArgs.vb
new file mode 100644
index 0000000..41f2c49
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/CarEventArgs.vb
@@ -0,0 +1,11 @@
+Option Explicit On
+Option Strict On
+
+Public Class CarEventArgs
+ Inherits EventArgs
+
+ Public ReadOnly msgData As String
+ Public Sub New(ByVal msg As String)
+ msgData = msg
+ End Sub
+End Class
diff --git a/Code/Chapter 11/CustomEvent/CustomEvent.sln b/Code/Chapter 11/CustomEvent/CustomEvent.sln
new file mode 100644
index 0000000..bd26e0b
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/CustomEvent.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CustomEvent", "CustomEvent.vbproj", "{6FC77026-E19B-46A4-9C67-3D3D66163389}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6FC77026-E19B-46A4-9C67-3D3D66163389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6FC77026-E19B-46A4-9C67-3D3D66163389}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6FC77026-E19B-46A4-9C67-3D3D66163389}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6FC77026-E19B-46A4-9C67-3D3D66163389}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 11/CustomEvent/CustomEvent.suo b/Code/Chapter 11/CustomEvent/CustomEvent.suo
new file mode 100644
index 0000000..a1de2b5
Binary files /dev/null and b/Code/Chapter 11/CustomEvent/CustomEvent.suo differ
diff --git a/Code/Chapter 11/CustomEvent/CustomEvent.vbproj b/Code/Chapter 11/CustomEvent/CustomEvent.vbproj
new file mode 100644
index 0000000..684da50
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/CustomEvent.vbproj
@@ -0,0 +1,99 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {6FC77026-E19B-46A4-9C67-3D3D66163389}
+ Exe
+ CustomEvent.Program
+ CustomEvent
+ CustomEvent
+ Console
+
+
+ 2.0
+
+
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ CustomEvent.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ CustomEvent.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEvent/CustomEvent.vbproj.user b/Code/Chapter 11/CustomEvent/CustomEvent.vbproj.user
new file mode 100644
index 0000000..a1d742b
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/CustomEvent.vbproj.user
@@ -0,0 +1,5 @@
+
+
+ ProjectFiles
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEvent/My Project/Application.Designer.vb b/Code/Chapter 11/CustomEvent/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 11/CustomEvent/My Project/Application.myapp b/Code/Chapter 11/CustomEvent/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 11/CustomEvent/My Project/AssemblyInfo.vb b/Code/Chapter 11/CustomEvent/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..321d47d
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 11/CustomEvent/My Project/Resources.Designer.vb b/Code/Chapter 11/CustomEvent/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..2aa02a8
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CustomEvent.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CustomEvent/My Project/Resources.resx b/Code/Chapter 11/CustomEvent/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEvent/My Project/Settings.Designer.vb b/Code/Chapter 11/CustomEvent/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..c299bb2
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.CustomEvent.My.MySettings
+ Get
+ Return Global.CustomEvent.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CustomEvent/My Project/Settings.settings b/Code/Chapter 11/CustomEvent/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Code/Chapter 11/CustomEvent/Program.vb b/Code/Chapter 11/CustomEvent/Program.vb
new file mode 100644
index 0000000..21ec4ac
--- /dev/null
+++ b/Code/Chapter 11/CustomEvent/Program.vb
@@ -0,0 +1,28 @@
+Option Explicit On
+Option Strict On
+
+Module Program
+ Sub Main()
+ Console.WriteLine("***** Fun with Custom Events *****")
+ Console.WriteLine()
+
+ Dim c As New Car()
+
+ ' Dynamically hook into event.
+ AddHandler c.EngineStart, AddressOf EngineStartHandler
+ c.Start()
+
+ ' Just to trigger our custom logic.
+ RemoveHandler c.EngineStart, AddressOf EngineStartHandler
+
+ ' Just to test we are no longer sending event.
+ c.Start()
+ Console.ReadLine()
+ End Sub
+
+ ' Our handler must match this signature given that
+ ' EngineStart has been prototyped using the System.EventHandler delegate.
+ Public Sub EngineStartHandler(ByVal sender As Object, ByVal e As EventArgs)
+ Console.WriteLine("Car has started")
+ End Sub
+End Module
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/Car.vb b/Code/Chapter 11/CustomEventWithCustomDelegate/Car.vb
new file mode 100644
index 0000000..d3fd51a
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/Car.vb
@@ -0,0 +1,35 @@
+Option Explicit On
+Option Strict On
+
+Public Class Car
+ ' The custom delegate.
+ Public Delegate Sub CarDelegate(ByVal sender As Object, ByVal args As CarEventArgs)
+
+ ' This ArrayList will hold onto the delegates
+ ' sent from the caller.
+ Private arConnections As New ArrayList()
+
+ ' This event has been customized!
+ Public Custom Event EngineStart As CarDelegate
+ AddHandler(ByVal value As CarDelegate)
+ Console.WriteLine("Added connection")
+ arConnections.Add(value)
+ End AddHandler
+
+ RemoveHandler(ByVal value As CarDelegate)
+ Console.WriteLine("Removed connection")
+ arConnections.Remove(value)
+ End RemoveHandler
+
+ RaiseEvent(ByVal sender As Object, ByVal e As CarEventArgs)
+ For Each h As CarDelegate In arConnections
+ Console.WriteLine("Raising event")
+ h.Invoke(sender, e)
+ Next
+ End RaiseEvent
+ End Event
+
+ Public Sub Start()
+ RaiseEvent EngineStart(Me, New CarEventArgs("Enjoy the ride"))
+ End Sub
+End Class
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/CarEventArgs.vb b/Code/Chapter 11/CustomEventWithCustomDelegate/CarEventArgs.vb
new file mode 100644
index 0000000..41f2c49
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/CarEventArgs.vb
@@ -0,0 +1,11 @@
+Option Explicit On
+Option Strict On
+
+Public Class CarEventArgs
+ Inherits EventArgs
+
+ Public ReadOnly msgData As String
+ Public Sub New(ByVal msg As String)
+ msgData = msg
+ End Sub
+End Class
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.sln b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.sln
new file mode 100644
index 0000000..3944fa1
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CustomEventWithCustomDelegate", "CustomEventWithCustomDelegate.vbproj", "{9154A997-3359-4893-9F01-8CE491F1F03C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9154A997-3359-4893-9F01-8CE491F1F03C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9154A997-3359-4893-9F01-8CE491F1F03C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9154A997-3359-4893-9F01-8CE491F1F03C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9154A997-3359-4893-9F01-8CE491F1F03C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.suo b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.suo
new file mode 100644
index 0000000..78be5ca
Binary files /dev/null and b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.suo differ
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.vbproj b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.vbproj
new file mode 100644
index 0000000..e29e3c5
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.vbproj
@@ -0,0 +1,99 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {9154A997-3359-4893-9F01-8CE491F1F03C}
+ Exe
+ CustomEventWithCustomDelegate.Program
+ CustomEventWithCustomDelegate
+ CustomEventWithCustomDelegate
+ Console
+
+
+ 2.0
+
+
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ CustomEventWithCustomDelegate.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ CustomEventWithCustomDelegate.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.vbproj.user b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.vbproj.user
new file mode 100644
index 0000000..a1d742b
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/CustomEventWithCustomDelegate.vbproj.user
@@ -0,0 +1,5 @@
+
+
+ ProjectFiles
+
+
\ No newline at end of file
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Application.Designer.vb b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Application.Designer.vb
new file mode 100644
index 0000000..40fce7c
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Application.myapp b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Application.myapp
new file mode 100644
index 0000000..e62f1a5
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 2
+ true
+
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/AssemblyInfo.vb b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..31a9e2d
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Resources.Designer.vb b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..238492a
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.1433
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CustomEventWithCustomDelegate.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Resources.resx b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Code/Chapter 11/CustomEventWithCustomDelegate/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+