Commits

Nick Hodges  committed 1ab02d3

Added Anonymous Method demos

  • Participants
  • Parent commits 1ebc78f

Comments (0)

Files changed (20)

File AnonymousMethods/AnonymousMethodsCarRepairDemo.dpr

+program AnonymousMethodsCarRepairDemo;
+
+{$APPTYPE CONSOLE}
+
+uses
+  SysUtils,
+  Generics.Collections,
+  uCarRepair in 'uCarRepair.pas';
+
+
+
+begin
+  try
+    DoStuff;
+    ReadLn;
+  except
+    on E:Exception do
+      Writeln(E.Classname, ': ', E.Message);
+  end;
+end.

File AnonymousMethods/AnonymousMethodsCarRepairDemo.dproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{25524040-1EC5-4171-B9DB-47A3D0F2E79F}</ProjectGuid>
+			<ProjectVersion>13.4</ProjectVersion>
+			<MainSource>AnonymousMethodsCarRepairDemo.dpr</MainSource>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+			<FrameworkType>None</FrameworkType>
+			<Base>True</Base>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Console</AppType>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+			<Base_Win32>true</Base_Win32>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<VerInfo_Locale>1033</VerInfo_Locale>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+			<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<DCC_ImageBase>00400000</DCC_ImageBase>
+			<DCC_E>false</DCC_E>
+			<DCC_Platform>x86</DCC_Platform>
+			<DCC_DependencyCheckOutputName>AnonymousMethodsDemo.exe</DCC_DependencyCheckOutputName>
+			<DCC_N>false</DCC_N>
+			<DCC_S>false</DCC_S>
+			<DCC_F>false</DCC_F>
+			<DCC_K>false</DCC_K>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win32)'!=''">
+			<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+			<VerInfo_Locale>1033</VerInfo_Locale>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="$(MainSource)">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="uCarRepair.pas"/>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType/>
+			<BorlandProject>
+				<Delphi.Personality>
+					<Source>
+						<Source Name="MainSource">AnonymousMethodsCarRepairDemo.dpr</Source>
+					</Source>
+					<Parameters>
+						<Parameters Name="UseLauncher">False</Parameters>
+						<Parameters Name="LoadAllSymbols">True</Parameters>
+						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+					</Parameters>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1033</VersionInfo>
+						<VersionInfo Name="CodePage">1252</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+				</Delphi.Personality>
+				<Platforms>
+					<Platform value="Win64">False</Platform>
+					<Platform value="OSX32">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+		<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+	</Project>

File AnonymousMethods/AnonymousMethodsCarRepairDemo.res

Binary file added.

File AnonymousMethods/AnonymousMethodsFilterDemo.dpr

+program AnonymousMethodsFilterDemo;
+
+{$APPTYPE CONSOLE}
+
+{$R *.res}
+
+uses
+  System.SysUtils,
+  uFilterDemo in 'uFilterDemo.pas';
+
+
+begin
+  try
+    DoFilterStuff;
+    Readln;
+  except
+    on E: Exception do
+      Writeln(E.ClassName, ': ', E.Message);
+  end;
+end.

File AnonymousMethods/AnonymousMethodsFilterDemo.dproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{7BDFFA5C-0E08-4639-94D4-2AB764947B5D}</ProjectGuid>
+			<ProjectVersion>13.4</ProjectVersion>
+			<FrameworkType>None</FrameworkType>
+			<MainSource>AnonymousMethodsFilterDemo.dpr</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Console</AppType>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+			<Base_Win64>true</Base_Win64>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+			<Base_Win32>true</Base_Win32>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+			<Cfg_1_Win32>true</Cfg_1_Win32>
+			<CfgParent>Cfg_1</CfgParent>
+			<Cfg_1>true</Cfg_1>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_UsePackage>bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;CustomIPTransport;dsnap;DBXInformixDriver;fmxase;IndyCore;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;IPIndyImpl;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
+			<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
+			<DCC_E>false</DCC_E>
+			<DCC_N>false</DCC_N>
+			<DCC_S>false</DCC_S>
+			<DCC_F>false</DCC_F>
+			<DCC_K>false</DCC_K>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win64)'!=''">
+			<DCC_UsePackage>DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage)</DCC_UsePackage>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win32)'!=''">
+			<DCC_UsePackage>vcldbx;frx16;TeeDB;Rave100VCL;vclib;Tee;inetdbbde;DBXOdbcDriver;DBXSybaseASEDriver;ibxpress;svnui;vclimg;fmi;intrawebdb_120_160;frxDB16;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;VclSmp;fsDB16;frxe16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Locale>1033</VerInfo_Locale>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<DCC_Optimize>false</DCC_Optimize>
+			<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+			<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+			<DCC_RemoteDebug>true</DCC_RemoteDebug>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+			<DCC_RemoteDebug>false</DCC_RemoteDebug>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="$(MainSource)">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="uFilterDemo.pas"/>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType/>
+			<BorlandProject>
+				<Delphi.Personality>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1033</VersionInfo>
+						<VersionInfo Name="CodePage">1252</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+					<Source>
+						<Source Name="MainSource">AnonymousMethodsFilterDemo.dpr</Source>
+					</Source>
+				</Delphi.Personality>
+				<Deployment/>
+				<Platforms>
+					<Platform value="Win64">False</Platform>
+					<Platform value="OSX32">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+		<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+	</Project>

File AnonymousMethods/AnonymousMethodsFilterDemo.res

Binary file added.

File AnonymousMethods/AnonymousMethodsStepByStep.dpr

+program AnonymousMethodsStepByStep;
+
+{$APPTYPE CONSOLE}
+
+{$R *.res}
+
+uses
+  System.SysUtils,
+  Step1 in 'Step1.pas',
+  Step2 in 'Step2.pas',
+  Step3 in 'Step3.pas',
+  Step4 in 'Step4.pas',
+  Step5 in 'Step5.pas';
+
+begin
+  try
+    DoStuff1;
+    DoStuff2;
+    DoStuff3;
+    DoStuff4;
+    DoStuff5;
+    Readln;
+  except
+    on E: Exception do
+      Writeln(E.ClassName, ': ', E.Message);
+  end;
+end.

File AnonymousMethods/AnonymousMethodsStepByStep.dproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{9E5DF05C-16BF-428F-861C-8D9188F43F61}</ProjectGuid>
+			<ProjectVersion>13.4</ProjectVersion>
+			<FrameworkType>None</FrameworkType>
+			<MainSource>AnonymousMethodsStepByStep.dpr</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Console</AppType>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+			<Base_Win64>true</Base_Win64>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+			<Base_Win32>true</Base_Win32>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+			<Cfg_1_Win32>true</Cfg_1_Win32>
+			<CfgParent>Cfg_1</CfgParent>
+			<Cfg_1>true</Cfg_1>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_UsePackage>bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;CustomIPTransport;dsnap;DBXInformixDriver;fmxase;IndyCore;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;IPIndyImpl;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
+			<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
+			<DCC_E>false</DCC_E>
+			<DCC_N>false</DCC_N>
+			<DCC_S>false</DCC_S>
+			<DCC_F>false</DCC_F>
+			<DCC_K>false</DCC_K>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win64)'!=''">
+			<DCC_UsePackage>DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage)</DCC_UsePackage>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win32)'!=''">
+			<DCC_UsePackage>vcldbx;frx16;TeeDB;Rave100VCL;vclib;Tee;inetdbbde;DBXOdbcDriver;DBXSybaseASEDriver;ibxpress;vclimg;fmi;intrawebdb_120_160;frxDB16;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;VclSmp;fsDB16;frxe16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;bdertl;adortl;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Locale>1033</VerInfo_Locale>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<DCC_Optimize>false</DCC_Optimize>
+			<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+			<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+			<DCC_RemoteDebug>true</DCC_RemoteDebug>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+			<DCC_RemoteDebug>false</DCC_RemoteDebug>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="$(MainSource)">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="Step1.pas"/>
+			<DCCReference Include="Step2.pas"/>
+			<DCCReference Include="Step3.pas"/>
+			<DCCReference Include="Step4.pas"/>
+			<DCCReference Include="Step5.pas"/>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType/>
+			<BorlandProject>
+				<Delphi.Personality>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1033</VersionInfo>
+						<VersionInfo Name="CodePage">1252</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+					<Source>
+						<Source Name="MainSource">AnonymousMethodsStepByStep.dpr</Source>
+					</Source>
+				</Delphi.Personality>
+				<Deployment/>
+				<Platforms>
+					<Platform value="Win64">False</Platform>
+					<Platform value="OSX32">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+		<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+	</Project>

File AnonymousMethods/AnonymousMethodsStepByStep.res

Binary file added.

File AnonymousMethods/AnonymouseMethodsInversionOfControl.dpr

+program AnonymouseMethodsInversionOfControl;
+
+{$APPTYPE CONSOLE}
+
+{$R *.res}
+
+uses
+  System.SysUtils,
+  System.IOUtils,
+  System.Classes,
+  uAnonymousMethodsIOC in 'uAnonymousMethodsIOC.pas';
+
+procedure ProcessSomeWidgetsAndRecordToConsole;
+var
+  WidgetProcessor: TWidgetProcessor;
+  RecorderProc: TWidgetRecorderProc;
+begin
+  RecorderProc := procedure(const aCount: integer)
+                  begin
+                    Writeln('The Widget Recorder recorded ', aCount, ' widgets');
+                  end;
+
+  WidgetProcessor := TWidgetProcessor.Create(RecorderProc);
+  try
+    WidgetProcessor.ProcessWidgets(Random(100));
+  finally
+    WidgetProcessor.Free;
+  end;
+end;
+
+procedure ProcessSomeWidgetsAndRecordToFile;
+var
+  WidgetProcessor: TWidgetProcessor;
+  RecorderProc: TWidgetRecorderProc;
+const
+  cFilename = 'WidgetRecord.txt';
+begin
+  RecorderProc := procedure(const aCount: integer)
+                  var
+                    SL: TStringList;
+                    S: string;
+                  begin
+                    SL := TStringList.Create;
+                    try
+                      if TFile.Exists(cFilename) then
+                      begin
+                        SL.LoadFromFile(cFilename);
+                      end;
+                      S := Format('%s: %d widgets processed', [DateTimeToStr(Now), aCount]);
+                      SL.Add(S);
+                      SL.SaveToFile(cFilename);
+                    finally
+                      SL.Free;
+                    end;
+                  end;
+
+  WidgetProcessor := TWidgetProcessor.Create(RecorderProc);
+  try
+    WidgetProcessor.ProcessWidgets(Random(100));
+  finally
+    WidgetProcessor.Free;
+  end;
+end;
+
+var
+  i: integer;
+
+begin
+  try
+    Randomize;
+    for i := 1 to 5 do // do a few to make it interesting...
+    begin
+      ProcessSomeWidgetsAndRecordToConsole;
+      ProcessSomeWidgetsAndRecordToFile;
+    end;
+
+  except
+    on E: Exception do
+      Writeln(E.ClassName, ': ', E.Message);
+  end;
+  ReadLn;
+end.

File AnonymousMethods/AnonymouseMethodsInversionOfControl.dproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{BC60A434-591E-4D86-B00E-27258DE5F8E9}</ProjectGuid>
+			<ProjectVersion>13.4</ProjectVersion>
+			<FrameworkType>None</FrameworkType>
+			<MainSource>AnonymouseMethodsInversionOfControl.dpr</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Console</AppType>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+			<Base_Win64>true</Base_Win64>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+			<Base_Win32>true</Base_Win32>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+			<Cfg_1_Win32>true</Cfg_1_Win32>
+			<CfgParent>Cfg_1</CfgParent>
+			<Cfg_1>true</Cfg_1>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_UsePackage>bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;CustomIPTransport;dsnap;DBXInformixDriver;fmxase;IndyCore;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;IPIndyImpl;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
+			<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
+			<DCC_E>false</DCC_E>
+			<DCC_N>false</DCC_N>
+			<DCC_S>false</DCC_S>
+			<DCC_F>false</DCC_F>
+			<DCC_K>false</DCC_K>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win64)'!=''">
+			<DCC_UsePackage>DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage)</DCC_UsePackage>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win32)'!=''">
+			<DCC_UsePackage>vcldbx;frx16;TeeDB;Rave100VCL;vclib;Tee;inetdbbde;DBXOdbcDriver;DBXSybaseASEDriver;ibxpress;svnui;vclimg;fmi;intrawebdb_120_160;frxDB16;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;VclSmp;fsDB16;frxe16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Locale>1033</VerInfo_Locale>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<DCC_Optimize>false</DCC_Optimize>
+			<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+			<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+			<DCC_RemoteDebug>true</DCC_RemoteDebug>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+			<DCC_RemoteDebug>false</DCC_RemoteDebug>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="$(MainSource)">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="uAnonymousMethodsIOC.pas"/>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType/>
+			<BorlandProject>
+				<Delphi.Personality>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1033</VersionInfo>
+						<VersionInfo Name="CodePage">1252</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+					<Source>
+						<Source Name="MainSource">AnonymouseMethodsInversionOfControl.dpr</Source>
+					</Source>
+				</Delphi.Personality>
+				<Deployment/>
+				<Platforms>
+					<Platform value="Win64">False</Platform>
+					<Platform value="OSX32">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+		<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+	</Project>

File AnonymousMethods/AnonymouseMethodsInversionOfControl.res

Binary file added.

File AnonymousMethods/Step1.pas

+unit Step1;
+
+interface
+
+
+type
+  TCalculator = class
+    function Add(x, y: integer): integer;
+    function Subtract(x, y: integer): integer;
+  end;
+
+
+procedure DoStuff1;
+
+implementation
+
+procedure DoStuff1;
+var
+  Calculator: TCalculator;
+begin
+  Calculator := TCalculator.Create;
+  try
+    WriteLn('2 + 3 = ', Calculator.Add(2, 3));
+    WriteLn('5 - 2 = ', Calculator.Subtract(5, 2));
+  finally
+    Calculator.Free;
+  end;
+end;
+
+{ TCaculator }
+
+function TCalculator.Add(x, y: integer): integer;
+begin
+  Result := x + y;
+end;
+
+function TCalculator.Subtract(x, y: integer): integer;
+begin
+  Result := x - y;
+end;
+
+end.

File AnonymousMethods/Step2.pas

+unit Step2;
+
+interface
+
+type
+
+  TMathFunction = reference to function(x, y: integer): integer;
+
+  TCalculator = class
+    function Calculate(aMathFunction: TMathFunction; x, y: integer): integer;
+    function Add(x, y: integer): integer;
+    function Subtract(x, y: integer): integer;
+  end;
+
+procedure DoStuff2;
+
+implementation
+
+procedure DoStuff2;
+var
+  Calculator: TCalculator;
+  Multiply: TMathFunction;
+begin
+  Calculator := TCalculator.Create;
+  try
+    WriteLn('2 + 3 = ', Calculator.Add(2, 3));
+    WriteLn('5 - 2 = ', Calculator.Subtract(5, 2));
+
+    Multiply := function(x, y: integer): integer
+                          begin
+                            Result := x * y;
+                          end;
+    WriteLn('3 * 4 = ', Calculator.Calculate(Multiply, 3, 4));
+
+  finally
+    Calculator.Free;
+  end;
+
+end;
+
+{ TCaculator }
+
+function TCalculator.Add(x, y: integer): integer;
+begin
+  Result := x + y;
+end;
+
+function TCalculator.Calculate(aMathFunction: TMathFunction; x, y: integer): integer;
+begin
+  Result := aMathFunction(x, y);
+end;
+
+function TCalculator.Subtract(x, y: integer): integer;
+begin
+  Result := x - y;
+end;
+
+end.

File AnonymousMethods/Step3.pas

+unit Step3;
+
+interface
+
+type
+
+  TMathFunction = reference to function(x, y: integer): integer;
+
+  TCalculator = class
+    function Calculate(aMathFunction: TMathFunction; x, y: integer): integer;
+    function Add(x, y: integer): integer;
+    function Subtract(x, y: integer): integer;
+  end;
+
+procedure DoStuff3;
+
+implementation
+
+procedure DoStuff3;
+var
+  Calculator: TCalculator;
+  Add, Subtract, Multiply: TMathFunction;
+begin
+  Calculator := TCalculator.Create;
+  try
+
+
+    Multiply := function(x, y: integer): integer
+                          begin
+                            Result := x * y;
+                          end;
+    WriteLn('2 + 3 = ', Calculator.Add(2, 3));
+    WriteLn('5 - 2 = ', Calculator.Subtract(5, 2));
+    WriteLn('3 * 4 = ', Calculator.Calculate(Multiply, 3, 4));
+
+  finally
+    Calculator.Free;
+  end;
+
+end;
+
+{ TCaculator }
+
+function TCalculator.Add(x, y: integer): integer;
+var
+  Add: TMathFunction;
+begin
+  Add := function(x, y: integer): integer
+         begin
+           Result := x + y;
+         end;
+  Result := Calculate(Add, x, y);
+end;
+
+function TCalculator.Calculate(aMathFunction: TMathFunction; x, y: integer): integer;
+begin
+  Result := aMathFunction(x, y);
+end;
+
+function TCalculator.Subtract(x, y: integer): integer;
+var
+  Subtract: TMathFunction;
+begin
+  Subtract := function(x, y: integer): integer
+              begin
+                Result := x - y;
+              end;
+  Result := Calculate(Subtract, x, y);
+end;
+
+end.
+

File AnonymousMethods/Step4.pas

+unit Step4;
+
+interface
+
+type
+
+  TMathFunction<T1, T2> = reference to function(x, y: T1): T2;
+
+  TCalculator = class
+    function Calculate<T1, T2>(aMathFunction: TMathFunction<T1, T2>; x, y: T1): T2;
+  end;
+
+procedure DoStuff4;
+
+implementation
+
+procedure DoStuff4;
+var
+  Calculator: TCalculator;
+  AddInteger, SubtractInteger, MultiplyInteger: TMathFunction<integer, integer>;
+  AddDouble, SubtractDouble, MultiplyDouble: TMathFunction<Double, Double>;
+begin
+  Calculator := TCalculator.Create;
+  try
+    // Math with Integers
+    AddInteger      := function(x, y: integer): integer
+                          begin
+                            Result := x + y;
+                          end;
+
+    SubtractInteger := function(x, y: integer): integer
+                          begin
+                            Result := x - y;
+                          end;
+
+    MultiplyInteger := function(x, y: integer): integer
+                          begin
+                            Result := x * y;
+                          end;
+
+    WriteLn('2 + 3 = ', Calculator.Calculate<integer, integer>(AddInteger, 2, 3));
+    WriteLn('5 - 2 = ', Calculator.Calculate<integer, integer>(SubtractInteger, 5, 2));
+    WriteLn('3 * 4 = ', Calculator.Calculate<integer, integer>(MultiplyInteger, 3, 4));
+
+    // Math with Doubles
+    AddDouble      := function(x, y: Double): Double
+                          begin
+                            Result := x + y;
+                          end;
+
+    SubtractDouble := function(x, y: Double): Double
+                          begin
+                            Result := x - y;
+                          end;
+
+    MultiplyDouble := function(x, y: Double): Double
+                          begin
+                            Result := x * y;
+                          end;
+
+    WriteLn('2.5 + 3.3 = ', Calculator.Calculate<Double, Double>(AddDouble, 2.5, 3.3));
+    WriteLn('5.5 - 2.3 = ', Calculator.Calculate<Double, Double>(SubtractDouble, 5.5, 2.3));
+    WriteLn('3.5 * 4.3 = ', Calculator.Calculate<Double, Double>(MultiplyDouble, 3.5, 4.3));
+
+  finally
+    Calculator.Free;
+  end;
+
+end;
+
+{ TCaculator }
+
+function TCalculator.Calculate<T1, T2>(aMathFunction: TMathFunction<T1, T2>; x, y: T1): T2;
+begin
+  Result := aMathFunction(x, y);
+end;
+
+
+end.
+

File AnonymousMethods/Step5.pas

+unit Step5;
+
+interface
+
+uses
+       Spring
+     , Spring.Collections
+     ;
+
+type
+  TMathFunction<T1, T2> = reference to function(x, y: T1): T2;
+  TIntegerFunction = TMathFunction<integer, integer>;
+
+  TIntegerCalculator = class
+  strict private
+    FList: IDictionary<string, TIntegerFunction>;
+    procedure RegisterCalculations;
+  public
+    constructor Create;
+    procedure RegisterMathCalculation(aName: string; aCalculation: TIntegerFunction);
+    function Calculate(aName: string; x, y: integer): integer;
+  end;
+
+procedure DoStuff5;
+
+implementation
+
+function Power(x, y: integer): integer;
+begin
+  if y = 0 then
+  begin
+    Result := 1;
+  end else
+  begin
+    Result := x * Power(x, y - 1);
+  end;
+end;
+
+procedure DoStuff5;
+var
+  Calculator: TIntegerCalculator;
+begin
+  Calculator := TIntegerCalculator.Create;
+  try
+
+    WriteLn('2 + 3 = ', Calculator.Calculate('Add', 2, 3));
+    WriteLn('5 - 2 = ', Calculator.Calculate('Subtract', 5, 2));
+    WriteLn('3 * 4 = ', Calculator.Calculate('Multiply', 3, 4));
+
+    Calculator.RegisterMathCalculation('Power', function(x, y: integer): integer
+                                                begin
+                                                  Result := Power(x, y);
+                                                end  );
+
+    WriteLn('3 ^ 4 = ', Calculator.Calculate('Power', 3, 4));
+
+  finally
+    Calculator.Free;
+  end;
+
+end;
+
+{ TCaculator }
+
+function TIntegerCalculator.Calculate(aName: string; x, y: integer): integer;
+begin
+  Result := FList[aName](x, y);
+end;
+
+constructor TIntegerCalculator.Create;
+begin
+  inherited;
+  FList := TCollections.CreateDictionary<string, TIntegerFunction>;
+  RegisterCalculations;
+end;
+
+procedure TIntegerCalculator.RegisterCalculations;
+begin
+    RegisterMathCalculation('Add', function(x, y: integer): integer
+                                   begin
+                                     Result := x + y;
+                                   end);
+
+    RegisterMathCalculation('Subtract', function(x, y: integer): integer
+                                        begin
+                                          Result := x - y;
+                                        end);
+
+
+    RegisterMathCalculation('Multiply', function(x, y: integer): integer
+                                        begin
+                                          Result := x * y;
+                                        end);
+end;
+
+procedure TIntegerCalculator.RegisterMathCalculation(aName: string;  aCalculation: TIntegerFunction);
+begin
+  FList.Add(aName, aCalculation);
+end;
+
+end.
+
+

File AnonymousMethods/uAnonymousMethodsIOC.pas

+unit uAnonymousMethodsIOC;
+
+interface
+
+
+type
+  TWidgetRecorderProc = reference to procedure(const aCount: integer);
+
+type
+  TWidgetProcessor = class
+  private
+    FWidgetRecorder: TWidgetRecorderProc;
+  public
+    constructor Create(aWidgetRecorder: TWidgetRecorderProc);
+    procedure ProcessWidgets(aNumberToProcess: integer);
+    property WidgetRecorder: TWidgetRecorderProc read FWidgetRecorder write FWidgetRecorder;
+  end;
+
+implementation
+
+uses
+       SysUtils
+     ;
+
+{ TWidgetProcessor }
+
+constructor TWidgetProcessor.Create(aWidgetRecorder: TWidgetRecorderProc);
+begin
+  inherited Create;
+  FWidgetRecorder := aWidgetRecorder;
+end;
+
+procedure TWidgetProcessor.ProcessWidgets(aNumberToProcess: integer);
+begin
+  WriteLn('Processing ', aNumberToProcess, ' widgets.');
+  WidgetRecorder(aNumberToProcess);
+end;
+
+end.

File AnonymousMethods/uCarRepair.pas

+unit uCarRepair;
+
+interface
+
+uses Generics.Collections;
+
+type
+  TFixType = (cptSimple, cptRequiresCarOnLift, cptRequiresEnginePull, cptRecallPart);
+
+  TCarPart = record
+    Name: string;
+    Cost: integer;
+    PartType: TFixType;
+  end;
+
+  TCarRepairProcedure = reference to procedure(aPart: TCarPart);
+
+  function SimpleFix: TCarRepairProcedure;
+  function HardFix: TCarRepairProcedure;
+  function ReallyHardFix: TCarRepairProcedure;
+
+  var
+    TempTotalCost: integer;
+
+type
+  TCarRepairManager = class
+  private
+    FRepairList: TList<TCarPart>;
+  public
+    constructor Create;
+    procedure RepairCar(aCarPart: TCarPart; aRepairFunction: TCarRepairProcedure);
+    procedure AddRepair(aName: string; aCost: integer; aPartType: TFixType);
+    procedure DoRepairs;
+  end;
+
+  procedure DoStuff;
+
+implementation
+
+  function SimpleFix: TCarRepairProcedure;
+  begin
+    Result := procedure(aPart: TCarPart)
+              begin
+                WriteLn('-------------------');
+                WriteLn('Replace the ' + aPart.Name);
+                WriteLn('-------------------');
+              end;
+  end;
+
+  function HardFix: TCarRepairProcedure;
+  begin
+    Result := procedure(aPart: TCarPart)
+              begin
+                WriteLn('-------------------');
+                WriteLn('Put the car up on the rack.');
+                WriteLn('Replace the ' + aPart.Name);
+                WriteLn('-------------------');
+              end;
+  end;
+
+  function ReallyHardFix: TCarRepairProcedure;
+  begin
+    Result := procedure(aPart: TCarPart)
+              begin
+                WriteLn('-------------------');
+                WriteLn('Pull the engine from the car');
+                WriteLn('Replace the ' + aPart.Name);
+                WriteLn('Put the engine back in the car');
+                WriteLn('-------------------');
+              end;
+  end;
+
+  constructor TCarRepairManager.Create;
+begin
+  FRepairList := TList<TCarPart>.Create;
+end;
+
+procedure TCarRepairManager.DoRepairs;
+var
+  TempPart: TCarPart;
+begin
+    for TempPart in FRepairList do
+    begin
+      case TempPart.PartType of
+        cptSimple:              RepairCar(TempPart, SimpleFix());
+        cptRequiresCarOnLift:   RepairCar(TempPart, HardFix());
+        cptRequiresEnginePull:  RepairCar(TempPart, ReallyHardFix());
+      end;
+    end;
+
+end;
+
+procedure TCarRepairManager.RepairCar(aCarPart: TCarPart; aRepairFunction: TCarRepairProcedure);
+  begin
+    aRepairFunction(aCarPart);
+  end;
+
+  procedure TCarRepairManager.AddRepair(aName: string; aCost: integer; aPartType: TFixType);
+  var
+    NewPart: TCarPart;
+  begin
+      NewPart.Name := aName;
+      NewPart.Cost := aCost;
+      NewPart.PartType := aPartType;
+      FRepairList.Add(NewPart);
+  end;
+
+  procedure DoStuff;
+  var
+    TempPart: TCarPart;
+    RepairList: TList<TCarPart>;
+    RepairManager: TCarRepairManager;
+  begin
+    RepairManager := TCarRepairManager.Create;
+    try
+      TempPart.Name := 'Sticky Accelerator Pedal';
+      TempPart.Cost := 42;
+      TempPart.PartType := cptSimple;
+      RepairManager.RepairCar(TempPart,
+                procedure(aPart: TCarPart)
+                begin
+                  WriteLn('-------------------');
+                  WriteLn('Get Factory Recall Approval');
+                  WriteLn('Replace the ' + aPart.Name);
+                  WriteLn('-------------------');
+                end
+      );
+
+      RepairManager.AddRepair('Oil Filter', 14, cptSimple);
+      RepairManager.AddRepair('Transmission', 999, cptRequiresEnginePull);
+      RepairManager.AddRepair('Brakes', 499, cptRequiresCarOnLift);
+      RepairManager.AddRepair('HeadLight', 79, cptSimple);
+      RepairManager.AddRepair('Head Gasket', 999, cptRequiresEnginePull);
+
+      RepairManager.DoRepairs;
+
+    finally
+      RepairManager.Free;
+    end;
+  end;
+
+end.

File AnonymousMethods/uFilterDemo.pas

+unit uFilterDemo;
+
+interface
+
+type
+  TNumberPickerProc = reference to function(const aInteger: integer): boolean;
+
+procedure DoFilterStuff;
+
+implementation
+
+uses
+      Generics.Collections
+    ;
+
+procedure PickNumbers(aList: TList<integer>; aPicker: TNumberPickerProc);
+var
+  i: integer;
+begin
+  for i in aList do
+  begin
+    if aPicker(i) then
+    begin
+      Write(i, ', ');
+    end;
+  end;
+end;
+
+procedure DoFilterStuff;
+var
+  ListOfIntegers: TList<integer>;
+  i: integer;
+  PickEvens, PickOdds, PickDiv3: TNumberPickerProc;
+begin
+  ListOfIntegers := TList<integer>.Create;
+    try
+      for i := 1 to 20 do
+      begin
+        ListOfIntegers.Add(i);
+      end;
+
+      PickEvens := function(const x: integer): Boolean
+                   begin
+                     Result := (x mod 2) = 0;
+                   end;
+
+      PickOdds := function(const x: integer): Boolean
+                  begin
+                    Result := (x mod 2) <> 0;
+                  end;
+
+      PickDiv3 := function(const x: integer): Boolean
+                  begin
+                    Result := (x mod 3) = 0;
+                  end;
+
+      PickNumbers(ListOfIntegers, PickEvens);
+      WriteLn;
+      PickNumbers(ListOfIntegers, PickOdds);
+      WriteLn;
+      PickNumbers(ListOfIntegers, PickDiv3);
+
+    finally
+      ListOfIntegers.Free;
+    end;
+end;
+
+end.