├── .gitignore ├── CADelegate ├── CADelegate.csproj └── Program.cs ├── FunctionalProgramming ├── Employee.cs ├── ExtensionFunctional01.cs ├── ExtensionFunctional02.cs ├── ExtnensionProcedural.cs ├── FunctionalProgramming.csproj ├── Program.cs └── Repository.cs └── LINQTut01.sln /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # Tye 66 | .tye/ 67 | 68 | # ASP.NET Scaffolding 69 | ScaffoldingReadMe.txt 70 | 71 | # StyleCop 72 | StyleCopReport.xml 73 | 74 | # Files built by Visual Studio 75 | *_i.c 76 | *_p.c 77 | *_h.h 78 | *.ilk 79 | *.meta 80 | *.obj 81 | *.iobj 82 | *.pch 83 | *.pdb 84 | *.ipdb 85 | *.pgc 86 | *.pgd 87 | *.rsp 88 | *.sbr 89 | *.tlb 90 | *.tli 91 | *.tlh 92 | *.tmp 93 | *.tmp_proj 94 | *_wpftmp.csproj 95 | *.log 96 | *.vspscc 97 | *.vssscc 98 | .builds 99 | *.pidb 100 | *.svclog 101 | *.scc 102 | 103 | # Chutzpah Test files 104 | _Chutzpah* 105 | 106 | # Visual C++ cache files 107 | ipch/ 108 | *.aps 109 | *.ncb 110 | *.opendb 111 | *.opensdf 112 | *.sdf 113 | *.cachefile 114 | *.VC.db 115 | *.VC.VC.opendb 116 | 117 | # Visual Studio profiler 118 | *.psess 119 | *.vsp 120 | *.vspx 121 | *.sap 122 | 123 | # Visual Studio Trace Files 124 | *.e2e 125 | 126 | # TFS 2012 Local Workspace 127 | $tf/ 128 | 129 | # Guidance Automation Toolkit 130 | *.gpState 131 | 132 | # ReSharper is a .NET coding add-in 133 | _ReSharper*/ 134 | *.[Rr]e[Ss]harper 135 | *.DotSettings.user 136 | 137 | # TeamCity is a build add-in 138 | _TeamCity* 139 | 140 | # DotCover is a Code Coverage Tool 141 | *.dotCover 142 | 143 | # AxoCover is a Code Coverage Tool 144 | .axoCover/* 145 | !.axoCover/settings.json 146 | 147 | # Coverlet is a free, cross platform Code Coverage Tool 148 | coverage*.json 149 | coverage*.xml 150 | coverage*.info 151 | 152 | # Visual Studio code coverage results 153 | *.coverage 154 | *.coveragexml 155 | 156 | # NCrunch 157 | _NCrunch_* 158 | .*crunch*.local.xml 159 | nCrunchTemp_* 160 | 161 | # MightyMoose 162 | *.mm.* 163 | AutoTest.Net/ 164 | 165 | # Web workbench (sass) 166 | .sass-cache/ 167 | 168 | # Installshield output folder 169 | [Ee]xpress/ 170 | 171 | # DocProject is a documentation generator add-in 172 | DocProject/buildhelp/ 173 | DocProject/Help/*.HxT 174 | DocProject/Help/*.HxC 175 | DocProject/Help/*.hhc 176 | DocProject/Help/*.hhk 177 | DocProject/Help/*.hhp 178 | DocProject/Help/Html2 179 | DocProject/Help/html 180 | 181 | # Click-Once directory 182 | publish/ 183 | 184 | # Publish Web Output 185 | *.[Pp]ublish.xml 186 | *.azurePubxml 187 | # Note: Comment the next line if you want to checkin your web deploy settings, 188 | # but database connection strings (with potential passwords) will be unencrypted 189 | *.pubxml 190 | *.publishproj 191 | 192 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 193 | # checkin your Azure Web App publish settings, but sensitive information contained 194 | # in these scripts will be unencrypted 195 | PublishScripts/ 196 | 197 | # NuGet Packages 198 | *.nupkg 199 | # NuGet Symbol Packages 200 | *.snupkg 201 | # The packages folder can be ignored because of Package Restore 202 | **/[Pp]ackages/* 203 | # except build/, which is used as an MSBuild target. 204 | !**/[Pp]ackages/build/ 205 | # Uncomment if necessary however generally it will be regenerated when needed 206 | #!**/[Pp]ackages/repositories.config 207 | # NuGet v3's project.json files produces more ignorable files 208 | *.nuget.props 209 | *.nuget.targets 210 | 211 | # Microsoft Azure Build Output 212 | csx/ 213 | *.build.csdef 214 | 215 | # Microsoft Azure Emulator 216 | ecf/ 217 | rcf/ 218 | 219 | # Windows Store app package directories and files 220 | AppPackages/ 221 | BundleArtifacts/ 222 | Package.StoreAssociation.xml 223 | _pkginfo.txt 224 | *.appx 225 | *.appxbundle 226 | *.appxupload 227 | 228 | # Visual Studio cache files 229 | # files ending in .cache can be ignored 230 | *.[Cc]ache 231 | # but keep track of directories ending in .cache 232 | !?*.[Cc]ache/ 233 | 234 | # Others 235 | ClientBin/ 236 | ~$* 237 | *~ 238 | *.dbmdl 239 | *.dbproj.schemaview 240 | *.jfm 241 | *.pfx 242 | *.publishsettings 243 | orleans.codegen.cs 244 | 245 | # Including strong name files can present a security risk 246 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 247 | #*.snk 248 | 249 | # Since there are multiple workflows, uncomment next line to ignore bower_components 250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 251 | #bower_components/ 252 | 253 | # RIA/Silverlight projects 254 | Generated_Code/ 255 | 256 | # Backup & report files from converting an old project file 257 | # to a newer Visual Studio version. Backup files are not needed, 258 | # because we have git ;-) 259 | _UpgradeReport_Files/ 260 | Backup*/ 261 | UpgradeLog*.XML 262 | UpgradeLog*.htm 263 | ServiceFabricBackup/ 264 | *.rptproj.bak 265 | 266 | # SQL Server files 267 | *.mdf 268 | *.ldf 269 | *.ndf 270 | 271 | # Business Intelligence projects 272 | *.rdl.data 273 | *.bim.layout 274 | *.bim_*.settings 275 | *.rptproj.rsuser 276 | *- [Bb]ackup.rdl 277 | *- [Bb]ackup ([0-9]).rdl 278 | *- [Bb]ackup ([0-9][0-9]).rdl 279 | 280 | # Microsoft Fakes 281 | FakesAssemblies/ 282 | 283 | # GhostDoc plugin setting file 284 | *.GhostDoc.xml 285 | 286 | # Node.js Tools for Visual Studio 287 | .ntvs_analysis.dat 288 | node_modules/ 289 | 290 | # Visual Studio 6 build log 291 | *.plg 292 | 293 | # Visual Studio 6 workspace options file 294 | *.opt 295 | 296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 297 | *.vbw 298 | 299 | # Visual Studio LightSwitch build output 300 | **/*.HTMLClient/GeneratedArtifacts 301 | **/*.DesktopClient/GeneratedArtifacts 302 | **/*.DesktopClient/ModelManifest.xml 303 | **/*.Server/GeneratedArtifacts 304 | **/*.Server/ModelManifest.xml 305 | _Pvt_Extensions 306 | 307 | # Paket dependency manager 308 | .paket/paket.exe 309 | paket-files/ 310 | 311 | # FAKE - F# Make 312 | .fake/ 313 | 314 | # CodeRush personal settings 315 | .cr/personal 316 | 317 | # Python Tools for Visual Studio (PTVS) 318 | __pycache__/ 319 | *.pyc 320 | 321 | # Cake - Uncomment if you are using it 322 | # tools/** 323 | # !tools/packages.config 324 | 325 | # Tabs Studio 326 | *.tss 327 | 328 | # Telerik's JustMock configuration file 329 | *.jmconfig 330 | 331 | # BizTalk build output 332 | *.btp.cs 333 | *.btm.cs 334 | *.odx.cs 335 | *.xsd.cs 336 | 337 | # OpenCover UI analysis results 338 | OpenCover/ 339 | 340 | # Azure Stream Analytics local run output 341 | ASALocalRun/ 342 | 343 | # MSBuild Binary and Structured Log 344 | *.binlog 345 | 346 | # NVidia Nsight GPU debugger configuration file 347 | *.nvuser 348 | 349 | # MFractors (Xamarin productivity tool) working folder 350 | .mfractor/ 351 | 352 | # Local History for Visual Studio 353 | .localhistory/ 354 | 355 | # BeatPulse healthcheck temp database 356 | healthchecksdb 357 | 358 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 359 | MigrationBackup/ 360 | 361 | # Ionide (cross platform F# VS Code tools) working folder 362 | .ionide/ 363 | 364 | # Fody - auto-generated XML schema 365 | FodyWeavers.xsd 366 | 367 | ## 368 | ## Visual studio for Mac 369 | ## 370 | 371 | 372 | # globs 373 | Makefile.in 374 | *.userprefs 375 | *.usertasks 376 | config.make 377 | config.status 378 | aclocal.m4 379 | install-sh 380 | autom4te.cache/ 381 | *.tar.gz 382 | tarballs/ 383 | test-results/ 384 | 385 | # Mac bundle stuff 386 | *.dmg 387 | *.app 388 | 389 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 390 | # General 391 | .DS_Store 392 | .AppleDouble 393 | .LSOverride 394 | 395 | # Icon must end with two \r 396 | Icon 397 | 398 | 399 | # Thumbnails 400 | ._* 401 | 402 | # Files that might appear in the root of a volume 403 | .DocumentRevisions-V100 404 | .fseventsd 405 | .Spotlight-V100 406 | .TemporaryItems 407 | .Trashes 408 | .VolumeIcon.icns 409 | .com.apple.timemachine.donotpresent 410 | 411 | # Directories potentially created on remote AFP share 412 | .AppleDB 413 | .AppleDesktop 414 | Network Trash Folder 415 | Temporary Items 416 | .apdisk 417 | 418 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 419 | # Windows thumbnail cache files 420 | Thumbs.db 421 | ehthumbs.db 422 | ehthumbs_vista.db 423 | 424 | # Dump file 425 | *.stackdump 426 | 427 | # Folder config file 428 | [Dd]esktop.ini 429 | 430 | # Recycle Bin used on file shares 431 | $RECYCLE.BIN/ 432 | 433 | # Windows Installer files 434 | *.cab 435 | *.msi 436 | *.msix 437 | *.msm 438 | *.msp 439 | 440 | # Windows shortcuts 441 | *.lnk 442 | 443 | # JetBrains Rider 444 | .idea/ 445 | *.sln.iml 446 | 447 | ## 448 | ## Visual Studio Code 449 | ## 450 | .vscode/* 451 | !.vscode/settings.json 452 | !.vscode/tasks.json 453 | !.vscode/launch.json 454 | !.vscode/extensions.json 455 | -------------------------------------------------------------------------------- /CADelegate/CADelegate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CADelegate/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CADelegate 4 | { 5 | //delegate void MDelegate(); 6 | //Action, Func, Pred 7 | internal class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | // M2(M1); 12 | 13 | Action action = M1; 14 | M2(action); 15 | Console.ReadKey(); 16 | } 17 | 18 | static void M1() 19 | { 20 | Console.WriteLine("M1"); 21 | } 22 | 23 | static void M2(Action action) 24 | { 25 | action(); 26 | Console.WriteLine("M2"); 27 | } 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /FunctionalProgramming/Employee.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | 4 | namespace FunctionalProgramming 5 | { 6 | public class Employee 7 | { 8 | public Employee() { } 9 | public int Id { get; set; } 10 | 11 | public string FirstName { get; set; } 12 | 13 | public string LastName { get; set; } 14 | 15 | public DateTime HireDate { get; set; } 16 | 17 | public string Gender { get; set; } 18 | 19 | public string Department { get; set; } 20 | 21 | public bool HasHealthInsurance { get; set; } 22 | 23 | public bool HasPensionPlan { get; set; } 24 | 25 | public decimal Salary { get; set; } 26 | 27 | public override string ToString() 28 | { 29 | return 30 | string.Format($"" + 31 | $"{Id}\t" + 32 | $" {String.Concat(LastName, ", ", FirstName).PadRight(15, ' ')}\t" + 33 | $"{HireDate.Date.ToShortDateString()}\t" + 34 | $"{Gender.PadRight(10, ' ')}\t" + 35 | $"{Department.PadRight(10, ' ')}\t" + 36 | $"{HasHealthInsurance}\t" + 37 | $"{HasPensionPlan}\t" + 38 | $"${Salary.ToString("0.00")}"); 39 | } 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /FunctionalProgramming/ExtensionFunctional01.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FunctionalProgramming 8 | { 9 | public static class ExtensionFunctional01 10 | { 11 | public static IEnumerable Filter(IEnumerable source, Func predicate) // Func predicate = Predicate predicate 12 | { 13 | foreach (var employee in source) 14 | { 15 | if (predicate(employee)) 16 | { 17 | yield return employee; 18 | } 19 | } 20 | } 21 | 22 | public static void Print(IEnumerable source, string title) 23 | { 24 | if (source == null) 25 | return; 26 | Console.WriteLine(); 27 | Console.WriteLine("┌───────────────────────────────────────────────────────┐"); 28 | Console.WriteLine($"│ {title.PadRight(52, ' ')}│"); 29 | Console.WriteLine("└───────────────────────────────────────────────────────┘"); 30 | Console.WriteLine(); 31 | foreach (var item in source) 32 | Console.WriteLine(item); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /FunctionalProgramming/ExtensionFunctional02.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FunctionalProgramming 8 | { 9 | public static class ExtensionFunctional02 10 | { 11 | public static IEnumerable Filter(this IEnumerable source, Func predicate) // Func predicate = Predicate predicate 12 | { 13 | foreach (var employee in source) 14 | { 15 | if (predicate(employee)) 16 | { 17 | yield return employee; 18 | } 19 | } 20 | } 21 | 22 | public static void Print(this IEnumerable source, string title) 23 | { 24 | if (source == null) 25 | return; 26 | Console.WriteLine(); 27 | Console.WriteLine("┌───────────────────────────────────────────────────────┐"); 28 | Console.WriteLine($"│ {title.PadRight(52, ' ')}│"); 29 | Console.WriteLine("└───────────────────────────────────────────────────────┘"); 30 | Console.WriteLine(); 31 | foreach (var item in source) 32 | Console.WriteLine(item); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /FunctionalProgramming/ExtnensionProcedural.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FunctionalProgramming 8 | { 9 | public static class ExtnensionProcedural 10 | { 11 | public static IEnumerable GetEmployeesWithFirstNameStartsWith(string value) 12 | { 13 | var employees = Repository.LoadEmployees(); 14 | foreach (var employee in employees) 15 | { 16 | if (employee.FirstName.ToLowerInvariant().StartsWith(value.ToLowerInvariant())) 17 | { 18 | yield return employee; 19 | } 20 | } 21 | } 22 | 23 | //public static IEnumerable GetEmployeesWithFirstNameStartsWith(string value) 24 | //{ 25 | // var employees = Repository.LoadEmployees(); 26 | 27 | // var result = new List(); 28 | 29 | // foreach (var employee in employees) 30 | // { 31 | // if (employee.FirstName.ToLowerInvariant().StartsWith(value.ToLowerInvariant())) 32 | // { 33 | // result.Add(employee); 34 | // } 35 | // } 36 | // return result; 37 | //} 38 | 39 | public static IEnumerable GetEmployeesWithFirstNameEndsWith(string value) 40 | { 41 | var employees = Repository.LoadEmployees(); 42 | foreach (var employee in employees) 43 | { 44 | if (employee.FirstName.ToLowerInvariant().EndsWith(value.ToLowerInvariant())) 45 | { 46 | yield return employee; 47 | } 48 | } 49 | } 50 | 51 | public static IEnumerable GetEmployeesWithLastNameStartsWith(string value) 52 | { 53 | var employees = Repository.LoadEmployees(); 54 | foreach (var employee in employees) 55 | { 56 | if (employee.LastName.ToLowerInvariant().StartsWith(value.ToLowerInvariant())) 57 | { 58 | yield return employee; 59 | } 60 | } 61 | } 62 | 63 | public static IEnumerable GetEmployeesWithDepartmentEqualsTo(string value) 64 | { 65 | var employees = Repository.LoadEmployees(); 66 | foreach (var employee in employees) 67 | { 68 | if (employee.Department.ToLowerInvariant() == value.ToLowerInvariant()) 69 | { 70 | yield return employee; 71 | } 72 | } 73 | } 74 | 75 | public static IEnumerable GetEmployeesHiredInYear(int year) 76 | { 77 | var employees = Repository.LoadEmployees(); 78 | foreach (var employee in employees) 79 | { 80 | if (employee.HireDate.Year == year) 81 | { 82 | yield return employee; 83 | } 84 | } 85 | } 86 | 87 | public static IEnumerable GetEmployeesByGender(string gender) 88 | { 89 | var employees = Repository.LoadEmployees(); 90 | foreach (var employee in employees) 91 | { 92 | if (employee.Gender.ToLowerInvariant() == gender.ToLowerInvariant()) 93 | { 94 | yield return employee; 95 | } 96 | } 97 | } 98 | 99 | public static IEnumerable GetEmployeesWithHealthInsuranceValueEqualsTo(bool value) 100 | { 101 | var employees = Repository.LoadEmployees(); 102 | foreach (var employee in employees) 103 | { 104 | if (employee.HasHealthInsurance == value) 105 | { 106 | yield return employee; 107 | } 108 | } 109 | } 110 | 111 | public static IEnumerable GetEmployeesWithPensionPlanValueEqualsTo(bool value) 112 | { 113 | var employees = Repository.LoadEmployees(); 114 | foreach (var employee in employees) 115 | { 116 | if (employee.HasPensionPlan == value) 117 | { 118 | yield return employee; 119 | } 120 | } 121 | } 122 | 123 | public static IEnumerable GetEmployeesWithSalaryEqualsTo(decimal value) 124 | { 125 | var employees = Repository.LoadEmployees(); 126 | foreach (var employee in employees) 127 | { 128 | if (employee.Salary == value) 129 | { 130 | yield return employee; 131 | } 132 | } 133 | } 134 | 135 | public static IEnumerable GetEmployeesWithSalaryGreaterThan(decimal value) 136 | { 137 | var employees = Repository.LoadEmployees(); 138 | foreach (var employee in employees) 139 | { 140 | if (employee.Salary > value) 141 | { 142 | yield return employee; 143 | } 144 | } 145 | } 146 | 147 | public static IEnumerable GetEmployeesWithSalaryLessThan(decimal value) 148 | { 149 | var employees = Repository.LoadEmployees(); 150 | foreach (var employee in employees) 151 | { 152 | if (employee.Salary < value) 153 | { 154 | yield return employee; 155 | } 156 | } 157 | } 158 | 159 | public static void Print(IEnumerable source, string title) 160 | { 161 | if (source == null) 162 | return; 163 | Console.WriteLine(); 164 | Console.WriteLine("┌───────────────────────────────────────────────────────┐"); 165 | Console.WriteLine($"│ {title.PadRight(52, ' ')}│"); 166 | Console.WriteLine("└───────────────────────────────────────────────────────┘"); 167 | Console.WriteLine(); 168 | foreach (var item in source) 169 | Console.WriteLine(item); 170 | } 171 | 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /FunctionalProgramming/FunctionalProgramming.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FunctionalProgramming/Program.cs: -------------------------------------------------------------------------------- 1 |  using System; 2 | 3 | namespace FunctionalProgramming 4 | { 5 | internal class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | 10 | // RunExtensionProcedural(); 11 | // RunExtensionFunctional01(); 12 | RunExtensionFunctional02(); 13 | Console.ReadKey(); 14 | } 15 | 16 | private static void RunExtensionProcedural() 17 | { 18 | var q1 = ExtnensionProcedural.GetEmployeesWithFirstNameStartsWith("ma"); 19 | ExtnensionProcedural.Print(q1, "Employees with first name starts with 'ma'"); 20 | 21 | var q2 = ExtnensionProcedural.GetEmployeesWithLastNameStartsWith("ju"); 22 | ExtnensionProcedural.Print(q2, "Employees with last name starts with 'ju'"); 23 | 24 | var q3 = ExtnensionProcedural.GetEmployeesWithDepartmentEqualsTo("hr"); 25 | ExtnensionProcedural.Print(q3, "Employees in 'HR' department"); 26 | 27 | var q4 = ExtnensionProcedural.GetEmployeesByGender("female"); 28 | ExtnensionProcedural.Print(q4, "Female employees"); 29 | 30 | var q5 = ExtnensionProcedural.GetEmployeesHiredInYear(2018); 31 | ExtnensionProcedural.Print(q5, "Employees hired in '2018'"); 32 | 33 | var q6 = ExtnensionProcedural.GetEmployeesWithPensionPlanValueEqualsTo(true); 34 | ExtnensionProcedural.Print(q6, "Employees with Pension Plan"); 35 | 36 | var q7 = ExtnensionProcedural.GetEmployeesWithHealthInsuranceValueEqualsTo(false); 37 | ExtnensionProcedural.Print(q7, "Employees without Health insurance"); 38 | 39 | var q8 = ExtnensionProcedural.GetEmployeesWithSalaryEqualsTo(103200); 40 | ExtnensionProcedural.Print(q8, "Employees with Salary = $103200"); 41 | 42 | var q9 = ExtnensionProcedural.GetEmployeesWithSalaryGreaterThan(107000); 43 | ExtnensionProcedural.Print(q9, "Employees with Salary > $107000"); 44 | 45 | var q10 = ExtnensionProcedural.GetEmployeesWithSalaryLessThan(107000); 46 | ExtnensionProcedural.Print(q10, "Employees with Salary < $107000"); 47 | 48 | } 49 | 50 | private static void RunExtensionFunctional01() 51 | { 52 | var list = Repository.LoadEmployees(); 53 | 54 | //Func predicate = e => e.FirstName.ToLowerInvariant() == "ma"; 55 | //var q0 = ExtensionFunctional01.Filter(list, predicate); 56 | //ExtnensionProcedural.Print(q0, "Employees with first name starts with 'ma'"); 57 | 58 | 59 | var q1 = ExtensionFunctional01.Filter(list, e => e.FirstName.ToLowerInvariant() == "ma"); 60 | ExtnensionProcedural.Print(q1, "Employees with first name starts with 'ma'"); 61 | 62 | var q2 = ExtensionFunctional01.Filter(list, e => e.LastName.ToLowerInvariant() == "ju"); 63 | ExtnensionProcedural.Print(q2, "Employees with last name starts with 'ju'"); 64 | 65 | var q3 = ExtensionFunctional01.Filter(list, e => e.Department.ToLowerInvariant() == "hr"); 66 | ExtnensionProcedural.Print(q3, "Employees in 'HR' department"); 67 | 68 | var q4 = ExtensionFunctional01.Filter(list, e => e.Gender.ToLowerInvariant() == "female"); 69 | ExtnensionProcedural.Print(q4, "Female employees"); 70 | 71 | var q5 = ExtensionFunctional01.Filter(list, e => e.HireDate.Year == 2018); 72 | ExtnensionProcedural.Print(q5, "Employees hired in '2018'"); 73 | 74 | var q6 = ExtensionFunctional01.Filter(list, e => e.HasPensionPlan); 75 | ExtnensionProcedural.Print(q6, "Employees with Pension Plan"); 76 | 77 | var q7 = ExtensionFunctional01.Filter(list, e => !e.HasHealthInsurance); 78 | ExtnensionProcedural.Print(q7, "Employees without Health insurance"); 79 | 80 | var q8 = ExtensionFunctional01.Filter(list, e => e.Salary == 107000); 81 | ExtnensionProcedural.Print(q8, "Employees with Salary = $107000"); 82 | 83 | var q9 = ExtensionFunctional01.Filter(list, e => e.Salary > 107000); 84 | ExtnensionProcedural.Print(q9, "Employees with Salary > $107000"); 85 | 86 | var q10 = ExtensionFunctional01.Filter(list, e => e.Salary < 107000); 87 | ExtnensionProcedural.Print(q10, "Employees with Salary < $107000"); 88 | 89 | var q11 = ExtensionFunctional01.Filter(list, e => e.Salary < 107000 && e.Gender == "female"); 90 | ExtnensionProcedural.Print(q11, "Employees with Salary < $107000 and female"); 91 | 92 | } 93 | 94 | private static void RunExtensionFunctional02() 95 | { 96 | var list = Repository.LoadEmployees(); 97 | 98 | var q1 = list.Filter(e => e.FirstName.ToLowerInvariant() == "ma"); 99 | q1.Print("Employees with first name starts with 'ma'"); 100 | 101 | var q2 = list.Filter( e => e.LastName.ToLowerInvariant() == "ju"); 102 | q2.Print("Employees with last name starts with 'ju'"); 103 | 104 | var q3 = list.Filter( e => e.Department.ToLowerInvariant() == "hr"); 105 | q3.Print("Employees in 'HR' department"); 106 | 107 | var q4 = list.Filter( e => e.Gender.ToLowerInvariant() == "female"); 108 | q4.Print("Female employees"); 109 | 110 | var q5 = list.Filter(e => e.HireDate.Year == 2018); 111 | q5.Print("Employees hired in '2018'"); 112 | 113 | var q6 = list.Filter( e => e.HasPensionPlan); 114 | q6.Print("Employees with Pension Plan"); 115 | 116 | var q7 = list.Filter( e => !e.HasHealthInsurance); 117 | q7.Print("Employees without Health insurance"); 118 | 119 | var q8 = list.Filter(e => e.Salary == 107000); 120 | q8.Print("Employees with Salary = $107000"); 121 | 122 | var q9 = list.Filter( e => e.Salary > 107000); 123 | q9.Print("Employees with Salary > $107000"); 124 | 125 | var q10 = list.Filter( e => e.Salary < 107000); 126 | q10.Print("Employees with Salary < $107000"); 127 | 128 | var q11 = list.Filter( e => e.Salary < 107000 && e.Gender == "female"); 129 | q11.Print("Employees with Salary < $107000 and female"); 130 | 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /FunctionalProgramming/Repository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text.Json; 6 | using System.Xml; 7 | 8 | namespace FunctionalProgramming 9 | { 10 | public static class Repository 11 | { 12 | 13 | public static IEnumerable LoadEmployees() 14 | { 15 | return new List 16 | { 17 | new Employee 18 | { 19 | Id = 1001, 20 | FirstName = "Cochran", 21 | LastName = "Cole", 22 | HireDate = new DateTime(2017, 11, 2), 23 | Gender = "male", 24 | Department = "FIMAMCE", 25 | HasHealthInsurance = false, 26 | HasPensionPlan = true, 27 | Salary = 103200m 28 | }, 29 | new Employee 30 | { 31 | Id = 1002, 32 | FirstName = "Jaclyn", 33 | LastName = "Wolfe", 34 | HireDate = new DateTime(2018, 4, 14), 35 | Gender = "female", 36 | Department = "FIMAMCE", 37 | HasHealthInsurance = true, 38 | HasPensionPlan = false, 39 | Salary = 192400m 40 | }, 41 | new Employee 42 | { 43 | Id = 1003, 44 | FirstName = "Warner", 45 | LastName = "Jones", 46 | HireDate = new DateTime(2016, 12, 13), 47 | Gender = "male", 48 | Department = "IT", 49 | HasHealthInsurance = false, 50 | HasPensionPlan = false, 51 | Salary = 172800m 52 | }, 53 | new Employee 54 | { 55 | Id = 1004, 56 | FirstName = "Hester", 57 | LastName = "Evans", 58 | HireDate = new DateTime(2016, 8, 17), 59 | Gender = "male", 60 | Department = "FIMAMCE", 61 | HasHealthInsurance = true, 62 | HasPensionPlan = true, 63 | Salary = 155500m 64 | }, 65 | new Employee 66 | { 67 | Id = 1005, 68 | FirstName = "Wallace", 69 | LastName = "Buck", 70 | HireDate = new DateTime(2014, 5, 12), 71 | Gender = "male", 72 | Department = "IT", 73 | HasHealthInsurance = true, 74 | HasPensionPlan = false, 75 | Salary = 315800m 76 | }, 77 | new Employee 78 | { 79 | Id = 1006, 80 | FirstName = "Acevedo", 81 | LastName = "Wall", 82 | HireDate = new DateTime(2020, 10, 30), 83 | Gender = "male", 84 | Department = "IT", 85 | HasHealthInsurance = true, 86 | HasPensionPlan = false, 87 | Salary = 343700m 88 | }, 89 | new Employee 90 | { 91 | Id = 1007, 92 | FirstName = "Jacqueline", 93 | LastName = "Pickett", 94 | HireDate = new DateTime(2021, 2, 17), 95 | Gender = "female", 96 | Department = "IT", 97 | HasHealthInsurance = false, 98 | HasPensionPlan = false, 99 | Salary = 370000m 100 | }, 101 | new Employee 102 | { 103 | Id = 1008, 104 | FirstName = "Oconnor", 105 | LastName = "Espinoza", 106 | HireDate = new DateTime(2017, 3, 12), 107 | Gender = "male", 108 | Department = "HR", 109 | HasHealthInsurance = true, 110 | HasPensionPlan = false, 111 | Salary = 155600m 112 | }, 113 | new Employee 114 | { 115 | Id = 1009, 116 | FirstName = "Allie", 117 | LastName = "Elliott", 118 | HireDate = new DateTime(2020, 4, 20), 119 | Gender = "female", 120 | Department = "Accounting", 121 | HasHealthInsurance = false, 122 | HasPensionPlan = true, 123 | Salary = 315400m 124 | }, 125 | new Employee 126 | { 127 | Id = 1010, 128 | FirstName = "Elva", 129 | LastName = "Decker", 130 | HireDate = new DateTime(2016, 9, 6), 131 | Gender = "female", 132 | Department = "HR", 133 | HasHealthInsurance = true, 134 | HasPensionPlan = true, 135 | Salary = 345900m 136 | }, 137 | new Employee 138 | { 139 | Id = 1011, 140 | FirstName = "Hayes", 141 | LastName = "Beasley", 142 | HireDate = new DateTime(2020, 4, 25), 143 | Gender = "male", 144 | Department = "HR", 145 | HasHealthInsurance = false, 146 | HasPensionPlan = true, 147 | Salary = 372700m 148 | }, 149 | new Employee 150 | { 151 | Id = 1012, 152 | FirstName = "Florine", 153 | LastName = "Cervantes", 154 | HireDate = new DateTime(2015, 3, 25), 155 | Gender = "female", 156 | Department = "FIMAMCE", 157 | HasHealthInsurance = false, 158 | HasPensionPlan = true, 159 | Salary = 338700m 160 | }, 161 | new Employee 162 | { 163 | Id = 1013, 164 | FirstName = "Bullock", 165 | LastName = "Carney", 166 | HireDate = new DateTime(2017, 1, 3), 167 | Gender = "male", 168 | Department = "Accounting", 169 | HasHealthInsurance = false, 170 | HasPensionPlan = true, 171 | Salary = 214400m 172 | }, 173 | new Employee 174 | { 175 | Id = 1014, 176 | FirstName = "Carroll", 177 | LastName = "Cantu", 178 | HireDate = new DateTime(2021, 5, 26), 179 | Gender = "male", 180 | Department = "FIMAMCE", 181 | HasHealthInsurance = true, 182 | HasPensionPlan = false, 183 | Salary = 343200m 184 | }, 185 | new Employee 186 | { 187 | Id = 1015, 188 | FirstName = "Debra", 189 | LastName = "Hogan", 190 | HireDate = new DateTime(2019, 10, 4), 191 | Gender = "female", 192 | Department = "IT", 193 | HasHealthInsurance = false, 194 | HasPensionPlan = true, 195 | Salary = 249100m 196 | }, 197 | new Employee 198 | { 199 | Id = 1016, 200 | FirstName = "Winnie", 201 | LastName = "Mccall", 202 | HireDate = new DateTime(2019, 7, 17), 203 | Gender = "female", 204 | Department = "IT", 205 | HasHealthInsurance = true, 206 | HasPensionPlan = false, 207 | Salary = 287300m 208 | }, 209 | new Employee 210 | { 211 | Id = 1017, 212 | FirstName = "Manuela", 213 | LastName = "Berger", 214 | HireDate = new DateTime(2015, 12, 11), 215 | Gender = "female", 216 | Department = "IT", 217 | HasHealthInsurance = false, 218 | HasPensionPlan = true, 219 | Salary = 172500m 220 | }, 221 | new Employee 222 | { 223 | Id = 1018, 224 | FirstName = "Lakeisha", 225 | LastName = "Lowe", 226 | HireDate = new DateTime(2017, 1, 18), 227 | Gender = "female", 228 | Department = "IT", 229 | HasHealthInsurance = false, 230 | HasPensionPlan = true, 231 | Salary = 314300m 232 | }, 233 | new Employee 234 | { 235 | Id = 1019, 236 | FirstName = "Stewart", 237 | LastName = "Lott", 238 | HireDate = new DateTime(2016, 12, 12), 239 | Gender = "male", 240 | Department = "FIMAMCE", 241 | HasHealthInsurance = true, 242 | HasPensionPlan = true, 243 | Salary = 146600m 244 | }, 245 | new Employee 246 | { 247 | Id = 1020, 248 | FirstName = "Stafford", 249 | LastName = "Peck", 250 | HireDate = new DateTime(2014, 9, 25), 251 | Gender = "male", 252 | Department = "IT", 253 | HasHealthInsurance = true, 254 | HasPensionPlan = false, 255 | Salary = 320700m 256 | }, 257 | new Employee 258 | { 259 | Id = 1021, 260 | FirstName = "Barron", 261 | LastName = "Bird", 262 | HireDate = new DateTime(2020, 5, 18), 263 | Gender = "male", 264 | Department = "HR", 265 | HasHealthInsurance = false, 266 | HasPensionPlan = true, 267 | Salary = 151200m 268 | }, 269 | new Employee 270 | { 271 | Id = 1022, 272 | FirstName = "Nona", 273 | LastName = "Brooks", 274 | HireDate = new DateTime(2015, 12, 4), 275 | Gender = "female", 276 | Department = "IT", 277 | HasHealthInsurance = false, 278 | HasPensionPlan = true, 279 | Salary = 136500m 280 | }, 281 | new Employee 282 | { 283 | Id = 1023, 284 | FirstName = "Clara", 285 | LastName = "Reeves", 286 | HireDate = new DateTime(2014, 12, 6), 287 | Gender = "female", 288 | Department = "IT", 289 | HasHealthInsurance = true, 290 | HasPensionPlan = true, 291 | Salary = 245800m 292 | }, 293 | new Employee 294 | { 295 | Id = 1024, 296 | FirstName = "Karin", 297 | LastName = "Blanchard", 298 | HireDate = new DateTime(2018, 1, 20), 299 | Gender = "female", 300 | Department = "IT", 301 | HasHealthInsurance = false, 302 | HasPensionPlan = true, 303 | Salary = 341200m 304 | }, 305 | new Employee 306 | { 307 | Id = 1025, 308 | FirstName = "Burris", 309 | LastName = "Morgan", 310 | HireDate = new DateTime(2019, 7, 6), 311 | Gender = "male", 312 | Department = "Accounting", 313 | HasHealthInsurance = false, 314 | HasPensionPlan = false, 315 | Salary = 360300m 316 | }, 317 | new Employee 318 | { 319 | Id = 1026, 320 | FirstName = "Owen", 321 | LastName = "Cortez", 322 | HireDate = new DateTime(2021, 12, 9), 323 | Gender = "male", 324 | Department = "IT", 325 | HasHealthInsurance = false, 326 | HasPensionPlan = true, 327 | Salary = 193700m 328 | }, 329 | new Employee 330 | { 331 | Id = 1027, 332 | FirstName = "Letha", 333 | LastName = "Finch", 334 | HireDate = new DateTime(2016, 12, 18), 335 | Gender = "female", 336 | Department = "Accounting", 337 | HasHealthInsurance = true, 338 | HasPensionPlan = true, 339 | Salary = 357200m 340 | }, 341 | new Employee 342 | { 343 | Id = 1028, 344 | FirstName = "Sondra", 345 | LastName = "Rojas", 346 | HireDate = new DateTime(2016, 4, 22), 347 | Gender = "female", 348 | Department = "Accounting", 349 | HasHealthInsurance = true, 350 | HasPensionPlan = false, 351 | Salary = 309700m 352 | }, 353 | new Employee 354 | { 355 | Id = 1029, 356 | FirstName = "Hoover", 357 | LastName = "Cook", 358 | HireDate = new DateTime(2020, 12, 17), 359 | Gender = "male", 360 | Department = "HR", 361 | HasHealthInsurance = true, 362 | HasPensionPlan = true, 363 | Salary = 282200m 364 | }, 365 | new Employee 366 | { 367 | Id = 1030, 368 | FirstName = "Wanda", 369 | LastName = "Bender", 370 | HireDate = new DateTime(2021, 6, 17), 371 | Gender = "female", 372 | Department = "Accounting", 373 | HasHealthInsurance = true, 374 | HasPensionPlan = true, 375 | Salary = 294200m 376 | }, 377 | new Employee 378 | { 379 | Id = 1031, 380 | FirstName = "Sanford", 381 | LastName = "Craig", 382 | HireDate = new DateTime(2020, 2, 27), 383 | Gender = "male", 384 | Department = "Accounting", 385 | HasHealthInsurance = true, 386 | HasPensionPlan = true, 387 | Salary = 278200m 388 | }, 389 | new Employee 390 | { 391 | Id = 1032, 392 | FirstName = "Christy", 393 | LastName = "Middleton", 394 | HireDate = new DateTime(2021, 4, 2), 395 | Gender = "female", 396 | Department = "FIMAMCE", 397 | HasHealthInsurance = false, 398 | HasPensionPlan = false, 399 | Salary = 377400m 400 | }, 401 | new Employee 402 | { 403 | Id = 1033, 404 | FirstName = "Day", 405 | LastName = "Brady", 406 | HireDate = new DateTime(2019, 1, 23), 407 | Gender = "male", 408 | Department = "HR", 409 | HasHealthInsurance = true, 410 | HasPensionPlan = true, 411 | Salary = 142600m 412 | }, 413 | new Employee 414 | { 415 | Id = 1034, 416 | FirstName = "Powers", 417 | LastName = "Beard", 418 | HireDate = new DateTime(2014, 4, 25), 419 | Gender = "male", 420 | Department = "FIMAMCE", 421 | HasHealthInsurance = false, 422 | HasPensionPlan = true, 423 | Salary = 224000m 424 | }, 425 | new Employee 426 | { 427 | Id = 1035, 428 | FirstName = "Arline", 429 | LastName = "Pratt", 430 | HireDate = new DateTime(2017, 8, 12), 431 | Gender = "female", 432 | Department = "FIMAMCE", 433 | HasHealthInsurance = false, 434 | HasPensionPlan = true, 435 | Salary = 360300m 436 | }, 437 | new Employee 438 | { 439 | Id = 1036, 440 | FirstName = "Sharpe", 441 | LastName = "Cardenas", 442 | HireDate = new DateTime(2017, 11, 28), 443 | Gender = "male", 444 | Department = "Accounting", 445 | HasHealthInsurance = false, 446 | HasPensionPlan = true, 447 | Salary = 266100m 448 | }, 449 | new Employee 450 | { 451 | Id = 1037, 452 | FirstName = "Madeleine", 453 | LastName = "Stanton", 454 | HireDate = new DateTime(2020, 7, 17), 455 | Gender = "female", 456 | Department = "Accounting", 457 | HasHealthInsurance = true, 458 | HasPensionPlan = true, 459 | Salary = 198300m 460 | }, 461 | new Employee 462 | { 463 | Id = 1038, 464 | FirstName = "Spears", 465 | LastName = "Noble", 466 | HireDate = new DateTime(2014, 10, 6), 467 | Gender = "male", 468 | Department = "FIMAMCE", 469 | HasHealthInsurance = true, 470 | HasPensionPlan = false, 471 | Salary = 176300m 472 | }, 473 | new Employee 474 | { 475 | Id = 1039, 476 | FirstName = "Gonzalez", 477 | LastName = "Gilliam", 478 | HireDate = new DateTime(2021, 4, 29), 479 | Gender = "male", 480 | Department = "IT", 481 | HasHealthInsurance = false, 482 | HasPensionPlan = false, 483 | Salary = 394300m 484 | }, 485 | new Employee 486 | { 487 | Id = 1040, 488 | FirstName = "Abigail", 489 | LastName = "Bradford", 490 | HireDate = new DateTime(2018, 4, 2), 491 | Gender = "female", 492 | Department = "FIMAMCE", 493 | HasHealthInsurance = true, 494 | HasPensionPlan = false, 495 | Salary = 296100m 496 | }, 497 | new Employee 498 | { 499 | Id = 1041, 500 | FirstName = "Ashlee", 501 | LastName = "Farmer", 502 | HireDate = new DateTime(2020, 9, 24), 503 | Gender = "female", 504 | Department = "IT", 505 | HasHealthInsurance = false, 506 | HasPensionPlan = true, 507 | Salary = 125300m 508 | }, 509 | new Employee 510 | { 511 | Id = 1042, 512 | FirstName = "Glover", 513 | LastName = "Lloyd", 514 | HireDate = new DateTime(2014, 2, 15), 515 | Gender = "male", 516 | Department = "IT", 517 | HasHealthInsurance = true, 518 | HasPensionPlan = false, 519 | Salary = 123000m 520 | }, 521 | new Employee 522 | { 523 | Id = 1043, 524 | FirstName = "Cleo", 525 | LastName = "Mays", 526 | HireDate = new DateTime(2018, 4, 24), 527 | Gender = "female", 528 | Department = "IT", 529 | HasHealthInsurance = false, 530 | HasPensionPlan = false, 531 | Salary = 214900m 532 | }, 533 | new Employee 534 | { 535 | Id = 1044, 536 | FirstName = "Patrice", 537 | LastName = "House", 538 | HireDate = new DateTime(2021, 10, 16), 539 | Gender = "female", 540 | Department = "IT", 541 | HasHealthInsurance = false, 542 | HasPensionPlan = true, 543 | Salary = 124500m 544 | }, 545 | new Employee 546 | { 547 | Id = 1045, 548 | FirstName = "Atkins", 549 | LastName = "Shannon", 550 | HireDate = new DateTime(2015, 9, 26), 551 | Gender = "male", 552 | Department = "Accounting", 553 | HasHealthInsurance = true, 554 | HasPensionPlan = false, 555 | Salary = 136600m 556 | }, 557 | new Employee 558 | { 559 | Id = 1046, 560 | FirstName = "Luisa", 561 | LastName = "Hopkins", 562 | HireDate = new DateTime(2016, 8, 1), 563 | Gender = "female", 564 | Department = "Accounting", 565 | HasHealthInsurance = true, 566 | HasPensionPlan = true, 567 | Salary = 192900m 568 | }, 569 | new Employee 570 | { 571 | Id = 1047, 572 | FirstName = "Kaufman", 573 | LastName = "Gross", 574 | HireDate = new DateTime(2016, 7, 24), 575 | Gender = "male", 576 | Department = "IT", 577 | HasHealthInsurance = false, 578 | HasPensionPlan = true, 579 | Salary = 223600m 580 | }, 581 | new Employee 582 | { 583 | Id = 1048, 584 | FirstName = "William", 585 | LastName = "Clay", 586 | HireDate = new DateTime(2014, 8, 24), 587 | Gender = "male", 588 | Department = "HR", 589 | HasHealthInsurance = false, 590 | HasPensionPlan = true, 591 | Salary = 237500m 592 | }, 593 | new Employee 594 | { 595 | Id = 1049, 596 | FirstName = "Alison", 597 | LastName = "Kirby", 598 | HireDate = new DateTime(2014, 7, 14), 599 | Gender = "female", 600 | Department = "IT", 601 | HasHealthInsurance = false, 602 | HasPensionPlan = false, 603 | Salary = 354800m 604 | }, 605 | new Employee 606 | { 607 | Id = 1050, 608 | FirstName = "Morrow", 609 | LastName = "Lynch", 610 | HireDate = new DateTime(2014, 6, 4), 611 | Gender = "male", 612 | Department = "Accounting", 613 | HasHealthInsurance = false, 614 | HasPensionPlan = false, 615 | Salary = 281400m 616 | }, 617 | new Employee 618 | { 619 | Id = 1051, 620 | FirstName = "Roach", 621 | LastName = "Bright", 622 | HireDate = new DateTime(2019, 9, 14), 623 | Gender = "male", 624 | Department = "IT", 625 | HasHealthInsurance = true, 626 | HasPensionPlan = true, 627 | Salary = 326700m 628 | }, 629 | new Employee 630 | { 631 | Id = 1052, 632 | FirstName = "Carolyn", 633 | LastName = "Justice", 634 | HireDate = new DateTime(2019, 8, 29), 635 | Gender = "female", 636 | Department = "FIMAMCE", 637 | HasHealthInsurance = false, 638 | HasPensionPlan = false, 639 | Salary = 143100m 640 | }, 641 | new Employee 642 | { 643 | Id = 1053, 644 | FirstName = "Cathryn", 645 | LastName = "Mathews", 646 | HireDate = new DateTime(2016, 5, 31), 647 | Gender = "female", 648 | Department = "FIMAMCE", 649 | HasHealthInsurance = false, 650 | HasPensionPlan = true, 651 | Salary = 366000m 652 | }, 653 | new Employee 654 | { 655 | Id = 1054, 656 | FirstName = "Lindsay", 657 | LastName = "Pruitt", 658 | HireDate = new DateTime(2016, 6, 9), 659 | Gender = "female", 660 | Department = "Accounting", 661 | HasHealthInsurance = true, 662 | HasPensionPlan = false, 663 | Salary = 107300m 664 | }, 665 | new Employee 666 | { 667 | Id = 1055, 668 | FirstName = "Cummings", 669 | LastName = "Webster", 670 | HireDate = new DateTime(2016, 1, 24), 671 | Gender = "male", 672 | Department = "Accounting", 673 | HasHealthInsurance = true, 674 | HasPensionPlan = false, 675 | Salary = 222700m 676 | }, 677 | new Employee 678 | { 679 | Id = 1056, 680 | FirstName = "Cannon", 681 | LastName = "Pace", 682 | HireDate = new DateTime(2017, 7, 29), 683 | Gender = "male", 684 | Department = "Accounting", 685 | HasHealthInsurance = false, 686 | HasPensionPlan = true, 687 | Salary = 345000m 688 | }, 689 | new Employee 690 | { 691 | Id = 1057, 692 | FirstName = "Barber", 693 | LastName = "Singleton", 694 | HireDate = new DateTime(2017, 5, 8), 695 | Gender = "male", 696 | Department = "Accounting", 697 | HasHealthInsurance = false, 698 | HasPensionPlan = true, 699 | Salary = 192400m 700 | }, 701 | new Employee 702 | { 703 | Id = 1058, 704 | FirstName = "Aileen", 705 | LastName = "Sweet", 706 | HireDate = new DateTime(2018, 7, 4), 707 | Gender = "female", 708 | Department = "Accounting", 709 | HasHealthInsurance = false, 710 | HasPensionPlan = false, 711 | Salary = 262400m 712 | }, 713 | new Employee 714 | { 715 | Id = 1059, 716 | FirstName = "Lindsey", 717 | LastName = "Hughes", 718 | HireDate = new DateTime(2014, 4, 26), 719 | Gender = "male", 720 | Department = "FIMAMCE", 721 | HasHealthInsurance = true, 722 | HasPensionPlan = false, 723 | Salary = 370000m 724 | }, 725 | new Employee 726 | { 727 | Id = 1060, 728 | FirstName = "Stout", 729 | LastName = "Phillips", 730 | HireDate = new DateTime(2019, 6, 19), 731 | Gender = "male", 732 | Department = "FIMAMCE", 733 | HasHealthInsurance = true, 734 | HasPensionPlan = false, 735 | Salary = 151000m 736 | }, 737 | new Employee 738 | { 739 | Id = 1061, 740 | FirstName = "Benjamin", 741 | LastName = "Stephens", 742 | HireDate = new DateTime(2021, 5, 7), 743 | Gender = "male", 744 | Department = "Accounting", 745 | HasHealthInsurance = false, 746 | HasPensionPlan = true, 747 | Salary = 399600m 748 | }, 749 | new Employee 750 | { 751 | Id = 1062, 752 | FirstName = "Mandy", 753 | LastName = "Odom", 754 | HireDate = new DateTime(2018, 10, 28), 755 | Gender = "female", 756 | Department = "Accounting", 757 | HasHealthInsurance = true, 758 | HasPensionPlan = false, 759 | Salary = 226400m 760 | }, 761 | new Employee 762 | { 763 | Id = 1063, 764 | FirstName = "Hays", 765 | LastName = "Austin", 766 | HireDate = new DateTime(2017, 5, 28), 767 | Gender = "male", 768 | Department = "Accounting", 769 | HasHealthInsurance = true, 770 | HasPensionPlan = false, 771 | Salary = 292000m 772 | }, 773 | new Employee 774 | { 775 | Id = 1064, 776 | FirstName = "Jean", 777 | LastName = "Salas", 778 | HireDate = new DateTime(2020, 10, 27), 779 | Gender = "female", 780 | Department = "HR", 781 | HasHealthInsurance = false, 782 | HasPensionPlan = false, 783 | Salary = 211600m 784 | }, 785 | new Employee 786 | { 787 | Id = 1065, 788 | FirstName = "Luann", 789 | LastName = "Hubbard", 790 | HireDate = new DateTime(2021, 7, 17), 791 | Gender = "female", 792 | Department = "HR", 793 | HasHealthInsurance = true, 794 | HasPensionPlan = true, 795 | Salary = 301600m 796 | }, 797 | new Employee 798 | { 799 | Id = 1066, 800 | FirstName = "Eaton", 801 | LastName = "Lyons", 802 | HireDate = new DateTime(2021, 7, 3), 803 | Gender = "male", 804 | Department = "IT", 805 | HasHealthInsurance = false, 806 | HasPensionPlan = false, 807 | Salary = 237600m 808 | }, 809 | new Employee 810 | { 811 | Id = 1067, 812 | FirstName = "Beck", 813 | LastName = "Ortiz", 814 | HireDate = new DateTime(2015, 5, 13), 815 | Gender = "male", 816 | Department = "HR", 817 | HasHealthInsurance = true, 818 | HasPensionPlan = false, 819 | Salary = 192900m 820 | }, 821 | new Employee 822 | { 823 | Id = 1068, 824 | FirstName = "Patty", 825 | LastName = "Knight", 826 | HireDate = new DateTime(2017, 8, 22), 827 | Gender = "female", 828 | Department = "IT", 829 | HasHealthInsurance = false, 830 | HasPensionPlan = false, 831 | Salary = 173100m 832 | }, 833 | new Employee 834 | { 835 | Id = 1069, 836 | FirstName = "Bowman", 837 | LastName = "Hampton", 838 | HireDate = new DateTime(2017, 10, 10), 839 | Gender = "male", 840 | Department = "IT", 841 | HasHealthInsurance = true, 842 | HasPensionPlan = true, 843 | Salary = 145200m 844 | }, 845 | new Employee 846 | { 847 | Id = 1070, 848 | FirstName = "Pace", 849 | LastName = "Bryant", 850 | HireDate = new DateTime(2019, 3, 1), 851 | Gender = "male", 852 | Department = "HR", 853 | HasHealthInsurance = false, 854 | HasPensionPlan = true, 855 | Salary = 160100m 856 | }, 857 | new Employee 858 | { 859 | Id = 1071, 860 | FirstName = "Watts", 861 | LastName = "Green", 862 | HireDate = new DateTime(2016, 10, 17), 863 | Gender = "male", 864 | Department = "FIMAMCE", 865 | HasHealthInsurance = true, 866 | HasPensionPlan = true, 867 | Salary = 330300m 868 | }, 869 | new Employee 870 | { 871 | Id = 1072, 872 | FirstName = "Sonia", 873 | LastName = "Clarke", 874 | HireDate = new DateTime(2014, 9, 15), 875 | Gender = "female", 876 | Department = "Accounting", 877 | HasHealthInsurance = true, 878 | HasPensionPlan = true, 879 | Salary = 201800m 880 | }, 881 | new Employee 882 | { 883 | Id = 1073, 884 | FirstName = "Donovan", 885 | LastName = "Brennan", 886 | HireDate = new DateTime(2018, 5, 18), 887 | Gender = "male", 888 | Department = "FIMAMCE", 889 | HasHealthInsurance = false, 890 | HasPensionPlan = false, 891 | Salary = 243600m 892 | }, 893 | new Employee 894 | { 895 | Id = 1074, 896 | FirstName = "Rutledge", 897 | LastName = "Harris", 898 | HireDate = new DateTime(2016, 7, 10), 899 | Gender = "male", 900 | Department = "IT", 901 | HasHealthInsurance = true, 902 | HasPensionPlan = false, 903 | Salary = 153300m 904 | }, 905 | new Employee 906 | { 907 | Id = 1075, 908 | FirstName = "Buckley", 909 | LastName = "Meyers", 910 | HireDate = new DateTime(2021, 10, 16), 911 | Gender = "male", 912 | Department = "FIMAMCE", 913 | HasHealthInsurance = true, 914 | HasPensionPlan = false, 915 | Salary = 342000m 916 | }, 917 | new Employee 918 | { 919 | Id = 1076, 920 | FirstName = "Reynolds", 921 | LastName = "Hammond", 922 | HireDate = new DateTime(2019, 10, 9), 923 | Gender = "male", 924 | Department = "Accounting", 925 | HasHealthInsurance = true, 926 | HasPensionPlan = true, 927 | Salary = 232600m 928 | }, 929 | new Employee 930 | { 931 | Id = 1077, 932 | FirstName = "Butler", 933 | LastName = "Bowen", 934 | HireDate = new DateTime(2019, 8, 13), 935 | Gender = "male", 936 | Department = "HR", 937 | HasHealthInsurance = false, 938 | HasPensionPlan = false, 939 | Salary = 239100m 940 | }, 941 | new Employee 942 | { 943 | Id = 1078, 944 | FirstName = "Karina", 945 | LastName = "Miles", 946 | HireDate = new DateTime(2018, 11, 20), 947 | Gender = "female", 948 | Department = "IT", 949 | HasHealthInsurance = false, 950 | HasPensionPlan = true, 951 | Salary = 185500m 952 | }, 953 | new Employee 954 | { 955 | Id = 1079, 956 | FirstName = "Fulton", 957 | LastName = "Conner", 958 | HireDate = new DateTime(2018, 7, 12), 959 | Gender = "male", 960 | Department = "Accounting", 961 | HasHealthInsurance = false, 962 | HasPensionPlan = false, 963 | Salary = 198100m 964 | }, 965 | new Employee 966 | { 967 | Id = 1080, 968 | FirstName = "Jewell", 969 | LastName = "Tran", 970 | HireDate = new DateTime(2019, 6, 22), 971 | Gender = "female", 972 | Department = "HR", 973 | HasHealthInsurance = true, 974 | HasPensionPlan = false, 975 | Salary = 264800m 976 | }, 977 | new Employee 978 | { 979 | Id = 1081, 980 | FirstName = "Avis", 981 | LastName = "Herrera", 982 | HireDate = new DateTime(2017, 11, 17), 983 | Gender = "female", 984 | Department = "Accounting", 985 | HasHealthInsurance = false, 986 | HasPensionPlan = true, 987 | Salary = 298800m 988 | }, 989 | new Employee 990 | { 991 | Id = 1082, 992 | FirstName = "Nora", 993 | LastName = "Dale", 994 | HireDate = new DateTime(2021, 7, 26), 995 | Gender = "female", 996 | Department = "IT", 997 | HasHealthInsurance = false, 998 | HasPensionPlan = false, 999 | Salary = 368900m 1000 | }, 1001 | new Employee 1002 | { 1003 | Id = 1083, 1004 | FirstName = "Hillary", 1005 | LastName = "Duran", 1006 | HireDate = new DateTime(2017, 2, 19), 1007 | Gender = "female", 1008 | Department = "Accounting", 1009 | HasHealthInsurance = false, 1010 | HasPensionPlan = false, 1011 | Salary = 282200m 1012 | }, 1013 | new Employee 1014 | { 1015 | Id = 1084, 1016 | FirstName = "Hamilton", 1017 | LastName = "Macias", 1018 | HireDate = new DateTime(2017, 10, 21), 1019 | Gender = "male", 1020 | Department = "HR", 1021 | HasHealthInsurance = false, 1022 | HasPensionPlan = true, 1023 | Salary = 237300m 1024 | }, 1025 | new Employee 1026 | { 1027 | Id = 1085, 1028 | FirstName = "Kent", 1029 | LastName = "Parsons", 1030 | HireDate = new DateTime(2018, 3, 30), 1031 | Gender = "male", 1032 | Department = "HR", 1033 | HasHealthInsurance = true, 1034 | HasPensionPlan = false, 1035 | Salary = 176400m 1036 | }, 1037 | new Employee 1038 | { 1039 | Id = 1086, 1040 | FirstName = "Dunn", 1041 | LastName = "Oliver", 1042 | HireDate = new DateTime(2018, 9, 3), 1043 | Gender = "male", 1044 | Department = "Accounting", 1045 | HasHealthInsurance = false, 1046 | HasPensionPlan = false, 1047 | Salary = 244400m 1048 | }, 1049 | new Employee 1050 | { 1051 | Id = 1087, 1052 | FirstName = "Betsy", 1053 | LastName = "Dean", 1054 | HireDate = new DateTime(2018, 11, 23), 1055 | Gender = "female", 1056 | Department = "IT", 1057 | HasHealthInsurance = false, 1058 | HasPensionPlan = false, 1059 | Salary = 196900m 1060 | }, 1061 | new Employee 1062 | { 1063 | Id = 1088, 1064 | FirstName = "Kay", 1065 | LastName = "May", 1066 | HireDate = new DateTime(2020, 9, 8), 1067 | Gender = "female", 1068 | Department = "Accounting", 1069 | HasHealthInsurance = false, 1070 | HasPensionPlan = true, 1071 | Salary = 224000m 1072 | }, 1073 | new Employee 1074 | { 1075 | Id = 1089, 1076 | FirstName = "Farley", 1077 | LastName = "Bartlett", 1078 | HireDate = new DateTime(2014, 7, 3), 1079 | Gender = "male", 1080 | Department = "IT", 1081 | HasHealthInsurance = true, 1082 | HasPensionPlan = false, 1083 | Salary = 369600m 1084 | }, 1085 | new Employee 1086 | { 1087 | Id = 1090, 1088 | FirstName = "Agnes", 1089 | LastName = "Riggs", 1090 | HireDate = new DateTime(2016, 11, 20), 1091 | Gender = "female", 1092 | Department = "IT", 1093 | HasHealthInsurance = true, 1094 | HasPensionPlan = true, 1095 | Salary = 106800m 1096 | }, 1097 | new Employee 1098 | { 1099 | Id = 1091, 1100 | FirstName = "White", 1101 | LastName = "Figueroa", 1102 | HireDate = new DateTime(2014, 6, 30), 1103 | Gender = "male", 1104 | Department = "HR", 1105 | HasHealthInsurance = false, 1106 | HasPensionPlan = true, 1107 | Salary = 226400m 1108 | }, 1109 | new Employee 1110 | { 1111 | Id = 1092, 1112 | FirstName = "Estes", 1113 | LastName = "Stone", 1114 | HireDate = new DateTime(2016, 7, 10), 1115 | Gender = "male", 1116 | Department = "HR", 1117 | HasHealthInsurance = false, 1118 | HasPensionPlan = false, 1119 | Salary = 293800m 1120 | }, 1121 | new Employee 1122 | { 1123 | Id = 1093, 1124 | FirstName = "Julia", 1125 | LastName = "Contreras", 1126 | HireDate = new DateTime(2017, 7, 1), 1127 | Gender = "female", 1128 | Department = "FIMAMCE", 1129 | HasHealthInsurance = false, 1130 | HasPensionPlan = false, 1131 | Salary = 203800m 1132 | }, 1133 | new Employee 1134 | { 1135 | Id = 1094, 1136 | FirstName = "Cecilia", 1137 | LastName = "Cooper", 1138 | HireDate = new DateTime(2017, 3, 31), 1139 | Gender = "female", 1140 | Department = "FIMAMCE", 1141 | HasHealthInsurance = false, 1142 | HasPensionPlan = true, 1143 | Salary = 329400m 1144 | }, 1145 | new Employee 1146 | { 1147 | Id = 1095, 1148 | FirstName = "Zelma", 1149 | LastName = "Frank", 1150 | HireDate = new DateTime(2015, 11, 29), 1151 | Gender = "female", 1152 | Department = "Accounting", 1153 | HasHealthInsurance = false, 1154 | HasPensionPlan = false, 1155 | Salary = 311100m 1156 | }, 1157 | new Employee 1158 | { 1159 | Id = 1096, 1160 | FirstName = "Peters", 1161 | LastName = "Morales", 1162 | HireDate = new DateTime(2021, 5, 19), 1163 | Gender = "male", 1164 | Department = "FIMAMCE", 1165 | HasHealthInsurance = true, 1166 | HasPensionPlan = true, 1167 | Salary = 120300m 1168 | }, 1169 | new Employee 1170 | { 1171 | Id = 1097, 1172 | FirstName = "Leigh", 1173 | LastName = "Moss", 1174 | HireDate = new DateTime(2016, 8, 2), 1175 | Gender = "female", 1176 | Department = "FIMAMCE", 1177 | HasHealthInsurance = false, 1178 | HasPensionPlan = true, 1179 | Salary = 167100m 1180 | }, 1181 | new Employee 1182 | { 1183 | Id = 1098, 1184 | FirstName = "Megan", 1185 | LastName = "Bailey", 1186 | HireDate = new DateTime(2014, 3, 4), 1187 | Gender = "female", 1188 | Department = "FIMAMCE", 1189 | HasHealthInsurance = true, 1190 | HasPensionPlan = false, 1191 | Salary = 232500m 1192 | }, 1193 | new Employee 1194 | { 1195 | Id = 1099, 1196 | FirstName = "Juliana", 1197 | LastName = "Pope", 1198 | HireDate = new DateTime(2020, 7, 3), 1199 | Gender = "female", 1200 | Department = "FIMAMCE", 1201 | HasHealthInsurance = false, 1202 | HasPensionPlan = false, 1203 | Salary = 305300m 1204 | }, 1205 | new Employee 1206 | { 1207 | Id = 1100, 1208 | FirstName = "Cervantes", 1209 | LastName = "Wong", 1210 | HireDate = new DateTime(2019, 11, 8), 1211 | Gender = "male", 1212 | Department = "IT", 1213 | HasHealthInsurance = false, 1214 | HasPensionPlan = false, 1215 | Salary = 235100m 1216 | } 1217 | }; 1218 | } 1219 | } 1220 | } 1221 | -------------------------------------------------------------------------------- /LINQTut01.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31903.59 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalProgramming", "FunctionalProgramming\FunctionalProgramming.csproj", "{496E856B-9272-4CE1-83A0-092E955BC90A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CADelegate", "CADelegate\CADelegate.csproj", "{61976451-94FB-4C4B-A51D-225E9EAB4FFD}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {496E856B-9272-4CE1-83A0-092E955BC90A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {496E856B-9272-4CE1-83A0-092E955BC90A}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {496E856B-9272-4CE1-83A0-092E955BC90A}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {496E856B-9272-4CE1-83A0-092E955BC90A}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {61976451-94FB-4C4B-A51D-225E9EAB4FFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {61976451-94FB-4C4B-A51D-225E9EAB4FFD}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {61976451-94FB-4C4B-A51D-225E9EAB4FFD}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {61976451-94FB-4C4B-A51D-225E9EAB4FFD}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {766CDA3B-638B-4C69-8572-6AC6AF376BDD} 30 | EndGlobalSection 31 | EndGlobal 32 | --------------------------------------------------------------------------------