├── .gitignore ├── Chapter02 ├── ConsoleApp1 │ ├── ConsoleApp1.sln │ └── ConsoleApp1 │ │ ├── ConsoleApp1.csproj │ │ └── Program.cs └── WpfApp1 │ ├── WpfApp1.sln │ └── WpfApp1 │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── WpfApp1.csproj │ └── WpfApp1.csproj.user ├── Chapter03 ├── Ch03Ex01 │ ├── Ch03Ex01.sln │ └── Ch03Ex01 │ │ ├── Ch03Ex01.csproj │ │ └── Program.cs └── Ch03Ex02 │ ├── Ch03Ex02.sln │ └── Ch03Ex02 │ ├── Ch03Ex02.csproj │ └── Program.cs ├── Chapter04 ├── Ch04Ex01 │ ├── Ch04Ex01.sln │ └── Ch04Ex01 │ │ ├── Ch04Ex01.csproj │ │ └── Program.cs ├── Ch04Ex02 │ ├── Ch04Ex02.sln │ └── Ch04Ex02 │ │ ├── Ch04Ex02.csproj │ │ └── Program.cs ├── Ch04Ex03 │ ├── Ch04Ex03.sln │ └── Ch04Ex03 │ │ ├── Ch04Ex03.csproj │ │ └── Program.cs ├── Ch04Ex04 │ ├── Ch04Ex04.sln │ └── Ch04Ex04 │ │ ├── Ch04Ex04.csproj │ │ └── Program.cs ├── Ch04Ex05 │ ├── Ch04Ex05.sln │ └── Ch04Ex05 │ │ ├── Ch04Ex05.csproj │ │ └── Program.cs └── readme.md ├── Chapter05 ├── Ch05Ex01 │ ├── Ch05Ex01.sln │ └── Ch05Ex01 │ │ ├── Ch05Ex01.csproj │ │ └── Program.cs ├── Ch05Ex02 │ ├── Ch05Ex02.sln │ └── Ch05Ex02 │ │ ├── Ch05Ex02.csproj │ │ └── Program.cs ├── Ch05Ex03 │ ├── Ch05Ex03.sln │ └── Ch05Ex03 │ │ ├── Ch05Ex03.csproj │ │ └── Program.cs ├── Ch05Ex04 │ ├── Ch05Ex04.sln │ └── Ch05Ex04 │ │ ├── Ch05Ex04.csproj │ │ └── Program.cs ├── Ch05Ex05 │ ├── Ch05Ex05.sln │ └── Ch05Ex05 │ │ ├── Ch05Ex05.csproj │ │ └── Program.cs ├── Ch05Ex06 │ ├── Ch05Ex06.sln │ └── Ch05Ex06 │ │ ├── Ch05Ex06.csproj │ │ └── Program.cs └── OverflowCheck │ ├── OverflowCheck.sln │ └── OverflowCheck │ ├── OverflowCheck.csproj │ └── Program.cs ├── Chapter06 ├── Ch06Ex01 │ ├── Ch06Ex01.sln │ └── Ch06Ex01 │ │ ├── Ch06Ex01.csproj │ │ └── Program.cs ├── Ch06Ex02 │ ├── Ch06Ex02.sln │ └── Ch06Ex02 │ │ ├── Ch06Ex02.csproj │ │ └── Program.cs ├── Ch06Ex03 │ ├── Ch06Ex03.sln │ └── Ch06Ex03 │ │ ├── Ch06Ex03.csproj │ │ └── Program.cs ├── Ch06Ex04 │ ├── Ch06Ex04.sln │ └── Ch06Ex04 │ │ ├── Ch06Ex04.csproj │ │ └── Program.cs ├── Ch06Ex05 │ ├── Ch06Ex05.sln │ └── Ch06Ex05 │ │ ├── Ch06Ex05.csproj │ │ └── Program.cs ├── LocalFunctions │ ├── LocalFunctions.sln │ └── LocalFunctions │ │ ├── LocalFunctions.csproj │ │ └── Program.cs ├── Tuple │ ├── Tuple.sln │ └── Tuple │ │ ├── Program.cs │ │ └── Tuple.csproj └── VariableScopeInLoops │ ├── VariableScopeInLoops.sln │ └── VariableScopeInLoops │ ├── Program.cs │ └── VariableScopeInLoops.csproj ├── Chapter07 ├── AssertionDemo │ ├── AssertionDemo.sln │ └── AssertionDemo │ │ ├── AssertionDemo.csproj │ │ └── Program.cs ├── Ch07Ex01 │ ├── Ch07Ex01.sln │ └── Ch07Ex01 │ │ ├── Ch07Ex01.csproj │ │ └── Program.cs ├── Ch07Ex01TracePoints │ ├── Ch07Ex01TracePoints.sln │ └── Ch07Ex01TracePoints │ │ ├── Ch07Ex01TracePoints.csproj │ │ └── Program.cs └── Ch07Ex02 │ ├── Ch07Ex02.sln │ └── Ch07Ex02 │ ├── Ch07Ex02.csproj │ └── Program.cs ├── Chapter08 ├── Ch08Ex01 │ ├── Ch08Ex01.sln │ └── Ch08Ex01 │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── AssemblyInfo.cs │ │ ├── Ch08Ex01.csproj │ │ ├── Ch08Ex01.csproj.user │ │ ├── MainWindow.xaml │ │ └── MainWindow.xaml.cs └── readme.md ├── Chapter09 ├── Ch09ClassLib │ ├── Ch09ClassLib.sln │ └── Ch09ClassLib │ │ ├── Ch09ClassLib.csproj │ │ ├── MyExternalClass.cs │ │ └── MyInternalClass.cs ├── Ch09Ex01 │ ├── Ch09Ex01.sln │ └── Ch09Ex01 │ │ ├── Ch09Ex01.csproj │ │ ├── MyNewClass.cs │ │ └── Program.cs ├── Ch09Ex02 │ ├── Ch09Ex02.sln │ └── Ch09Ex02 │ │ ├── Ch09Ex02.csproj │ │ └── Program.cs └── Ch09Ex03 │ ├── Ch09Ex03.sln │ └── Ch09Ex03 │ ├── Ch09Ex03.csproj │ └── Program.cs ├── Chapter10 ├── Ch10CardClient │ ├── Ch10CardClient.csproj │ └── Program.cs ├── Ch10CardLib │ ├── Ch10CardLib.sln │ └── Ch10CardLib │ │ ├── Card.cs │ │ ├── Ch10CardLib.csproj │ │ ├── ClassDiagram1.cd │ │ ├── Deck.cs │ │ ├── Rank.cs │ │ └── Suit.cs ├── Ch10Ex01 │ ├── Ch10Ex01.sln │ └── Ch10Ex01 │ │ ├── Ch10Ex01.csproj │ │ ├── MyClass.cs │ │ └── Program.cs └── Ch10Ex02 │ ├── Ch10Ex02.sln │ └── Ch10Ex02 │ ├── Ch10Ex02.csproj │ └── Program.cs ├── Chapter11 ├── Ch11CardClient │ ├── Ch11CardClient.sln │ └── Ch11CardClient │ │ ├── Ch11CardClient.csproj │ │ └── Program.cs ├── Ch11CardLib │ ├── Ch11CardLib.sln │ └── Ch11CardLib │ │ ├── Card.cs │ │ ├── CardCollection.cs │ │ ├── Ch11CardLib.csproj │ │ ├── Deck.cs │ │ ├── Rank.cs │ │ └── Suit.cs ├── Ch11Ex01 │ ├── Ch11Ex01.sln │ └── Ch11Ex01 │ │ ├── Animal.cs │ │ ├── Ch11Ex01.csproj │ │ ├── Chicken.cs │ │ ├── Cow.cs │ │ └── Program.cs ├── Ch11Ex02 │ ├── Ch11Ex02.sln │ └── Ch11Ex02 │ │ ├── Animal.cs │ │ ├── AnimalCollection.cs │ │ ├── Ch11Ex02.csproj │ │ ├── Chicken.cs │ │ ├── Cow.cs │ │ └── Program.cs ├── Ch11Ex03 │ ├── Ch11Ex03.sln │ └── Ch11Ex03 │ │ ├── Ch11Ex03.csproj │ │ ├── Primes.cs │ │ └── Program.cs ├── Ch11Ex04 │ ├── Ch11Ex04.sln │ └── Ch11Ex04 │ │ ├── Ch11Ex04.csproj │ │ └── Program.cs ├── Ch11Ex05 │ ├── Ch11Ex05.sln │ └── Ch11Ex05 │ │ ├── Ch11Ex05.csproj │ │ ├── Person.cs │ │ ├── PersonNameComparer.cs │ │ └── Program.cs └── SimpleIterators │ ├── SimpleIterators.sln │ └── SimpleIterators │ ├── Program.cs │ └── SimpleIterators.csproj ├── Chapter12 ├── Ch12CardClient │ ├── Ch12CardClient.sln │ └── Ch12CardClient │ │ ├── Ch12CardClient.csproj │ │ └── Program.cs ├── Ch12CardLib │ ├── Ch12CardLib.sln │ └── Ch12CardLib │ │ ├── Card.cs │ │ ├── CardCollection.cs │ │ ├── Ch12CardLib.csproj │ │ ├── Deck.cs │ │ ├── Rank.cs │ │ └── Suit.cs ├── Ch12Ex01 │ ├── Ch12Ex01.sln │ └── Ch12Ex01 │ │ ├── Ch12Ex01.csproj │ │ ├── Program.cs │ │ └── Vector.cs ├── Ch12Ex02 │ ├── Ch12Ex02.sln │ └── Ch12Ex02 │ │ ├── Animal.cs │ │ ├── Ch12Ex02.csproj │ │ ├── Chicken.cs │ │ ├── Cow.cs │ │ └── Program.cs ├── Ch12Ex03 │ ├── Ch12Ex03.sln │ └── Ch12Ex03 │ │ ├── Ch12Ex03.csproj │ │ ├── Program.cs │ │ ├── Vector.cs │ │ ├── VectorDelegates.cs │ │ └── VectorList.cs ├── Ch12Ex04 │ ├── Ch12Ex04.sln │ └── Ch12Ex04 │ │ ├── Animal.cs │ │ ├── Ch12Ex04.csproj │ │ ├── Chicken.cs │ │ ├── Cow.cs │ │ ├── Farm.cs │ │ ├── Program.cs │ │ └── SuperCow.cs └── VarianceDemo │ ├── VarianceDemo.sln │ └── VarianceDemo │ ├── Animal.cs │ ├── AnimalNameLengthComparer.cs │ ├── Chicken.cs │ ├── Cow.cs │ ├── IGrassMuncher.cs │ ├── IMethaneProducer.cs │ ├── Program.cs │ ├── SuperCow.cs │ └── VarianceDemo.csproj ├── Chapter13 ├── Ch13CardClient │ ├── Ch13CardClient.sln │ └── Ch13CardClient │ │ ├── Ch13CardClient.csproj │ │ ├── Game.cs │ │ ├── Player.cs │ │ └── Program.cs ├── Ch13CardLib │ ├── Ch13CardLib.sln │ └── Ch13CardLib │ │ ├── Card.cs │ │ ├── CardOutOfRangeException.cs │ │ ├── Cards.cs │ │ ├── Ch13CardLib.csproj │ │ ├── Deck.cs │ │ ├── Rank.cs │ │ └── Suit.cs ├── Ch13Ex01 │ ├── Ch13Ex01.sln │ └── Ch13Ex01 │ │ ├── Ch13Ex01.csproj │ │ └── Program.cs ├── Ch13Ex02 │ ├── Ch13Ex02.sln │ └── Ch13Ex02 │ │ ├── Ch13Ex02.csproj │ │ ├── Connection.cs │ │ ├── Display.cs │ │ └── Program.cs ├── Ch13Ex03 │ ├── Ch13Ex03.sln │ └── Ch13Ex03 │ │ ├── Ch13Ex03.csproj │ │ ├── Connection.cs │ │ ├── Display.cs │ │ ├── MessageArrivedEventArgs.cs │ │ └── Program.cs ├── Ch13Ex04 │ ├── Ch13Ex04.sln │ └── Ch13Ex04 │ │ ├── Animal.cs │ │ ├── Ch13Ex04.csproj │ │ ├── Chicken.cs │ │ ├── Cow.cs │ │ ├── Farm.cs │ │ ├── Program.cs │ │ └── SuperCow.cs ├── Ch13Ex05 │ ├── Ch13Ex05.sln │ └── Ch13Ex05 │ │ ├── Ch13Ex05.csproj │ │ └── Program.cs ├── Ch13Ex06 │ ├── Ch13Ex06.sln │ └── Ch13Ex06 │ │ ├── Ch13Ex06.csproj │ │ └── Program.cs ├── Ch13Ex07 │ ├── Ch13Ex07.sln │ └── Ch13Ex07 │ │ ├── Ch13Ex07.csproj │ │ ├── Program.cs │ │ └── WordProcessor.cs ├── Ch13Ex08 │ ├── Ch13Ex08.sln │ └── Ch13Ex08 │ │ ├── Ch13Ex08.csproj │ │ └── Program.cs ├── Ch13Ex09 │ ├── Ch13Ex09.sln │ └── Ch13Ex09 │ │ ├── Ch13Ex09.csproj │ │ └── Program.cs └── CustomAttributes │ ├── CustomAttributes.sln │ └── CustomAttributes │ ├── CustomAttributes.csproj │ └── Program.cs ├── Chapter14 ├── Compressor │ ├── Compressor.csproj │ ├── Compressor.sln │ └── Program.cs ├── FileWatch │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── FileWatch.csproj │ ├── FileWatch.sln │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs ├── ReadFile │ ├── Program.cs │ ├── ReadFile.csproj │ └── ReadFile.sln ├── StreamRead │ ├── Program.cs │ ├── StreamRead.csproj │ └── StreamRead.sln ├── StreamWrite │ ├── Program.cs │ ├── StreamWrite.csproj │ └── StreamWrite.sln └── WriteFile │ ├── Program.cs │ ├── WriteFile.csproj │ └── WriteFile.sln ├── Chapter15 ├── LoopThroughXmlDocument │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── LoopThroughXmlDocument.csproj │ ├── LoopThroughXmlDocument.sln │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs ├── SerializeJSON │ ├── Program.cs │ ├── SerializeJSON.csproj │ └── SerializeJSON.sln ├── XML and Schemas │ ├── Books.json │ ├── Books.xml │ ├── Elements.xml │ ├── GhostStories.xml │ └── GhostStories.xsd └── XPathQuery │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── XPathQuery.csproj │ └── XPathQuery.sln ├── Chapter16 ├── BeginningCSharpAndDotNET_16_10_GroupQuery │ ├── BeginningCSharpAndDotNET_16_10_GroupQuery.csproj │ ├── BeginningCSharpAndDotNET_16_10_GroupQuery.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_11_JoinQuery │ ├── BeginningCSharpAndDotNET_16_11_JoinQuery.csproj │ ├── BeginningCSharpAndDotNET_16_11_JoinQuery.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_1_LinqToXmlConstructors │ ├── BeginningCSharpAndDotNET_16_1_LinqToXmlConstructors.csproj │ ├── BeginningCSharpAndDotNET_16_1_LinqToXmlConstructors.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_2_XMLFragments │ ├── .vs │ │ └── BeginningCSharpAndDotNET_16_2_XMLFragments │ │ │ └── DesignTimeBuild │ │ │ └── .dtbcache.v2 │ ├── BeginningCSharpAndDotNET_16_2_XMLFragments.csproj │ ├── BeginningCSharpAndDotNET_16_2_XMLFragments.sln │ ├── Program.cs │ └── fragment.xml ├── BeginningCSharpAndDotNET_16_3_QuerySyntax │ ├── BeginningCSharpAndDotNET_16_3_QuerySyntax.csproj │ ├── BeginningCSharpAndDotNET_16_3_QuerySyntax.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_4_MethodSyntax │ ├── BeginningCSharpAndDotNET_16_4_MethodSyntax.csproj │ ├── BeginningCSharpAndDotNET_16_4_MethodSyntax.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_5_OrderQueryResults │ ├── BeginningCSharpAndDotNET_16_5_OrderQueryResults.csproj │ ├── BeginningCSharpAndDotNET_16_5_OrderQueryResults.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_6_LargeNumberQuery │ ├── BeginningCSharpAndDotNET_16_6_LargeNumberQuery.csproj │ ├── BeginningCSharpAndDotNET_16_6_LargeNumberQuery.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_7_NumericAggregates │ ├── BeginningCSharpAndDotNET_16_7_NumericAggregates.csproj │ ├── BeginningCSharpAndDotNET_16_7_NumericAggregates.sln │ └── Program.cs ├── BeginningCSharpAndDotNET_16_8_SelectDistinctQuery │ ├── BeginningCSharpAndDotNET_16_8_SelectDistinctQuery.csproj │ ├── BeginningCSharpAndDotNET_16_8_SelectDistinctQuery.sln │ └── Program.cs └── BeginningCSharpAndDotNET_16_9_MultiLevelOrdering │ ├── BeginningCSharpAndDotNET_16_9_MultiLevelOrdering.csproj │ ├── BeginningCSharpAndDotNET_16_9_MultiLevelOrdering.sln │ └── Program.cs ├── Chapter17 ├── BeginningCSharpAndDotNet_17_1_CodeFirstDatabase │ ├── BeginningCSharpAndDotNet_17_1_CodeFirstDatabase.csproj │ ├── BeginningCSharpAndDotNet_17_1_CodeFirstDatabase.sln │ ├── Migrations │ │ ├── 20210318013734_Initial.Designer.cs │ │ ├── 20210318013734_Initial.cs │ │ ├── 20210321220025_StoresAndStocks.Designer.cs │ │ ├── 20210321220025_StoresAndStocks.cs │ │ └── BookContextModelSnapshot.cs │ ├── Program - Copy.cs │ └── Program.cs ├── BeginningCSharpAndDotNet_17_2_XMLfromDatabase │ ├── BeginningCSharpAndDotNet_17_2_XMLfromDatabase.csproj │ ├── BeginningCSharpAndDotNet_17_2_XMLfromDatabase.sln │ ├── Book.cs │ ├── BooksContext.cs │ ├── Program.cs │ ├── Stock.cs │ └── Store.cs └── Readme.md ├── Chapter18 ├── Ch18CardClientCore │ ├── Ch18CardClientCore.sln │ └── Ch18CardClientCore │ │ ├── Ch18CardClientCore.csproj │ │ └── Program.cs └── Ch18CardLibStandard │ ├── Ch18CardLibStandard.sln │ └── Ch18CardLibStandard │ ├── CardGame.cs │ ├── Ch18CardLibStandard.csproj │ └── Ch18CardLibStandard.xml ├── Chapter19 ├── Ch19Ex01 │ ├── Ch19Ex01.sln │ └── Ch19Ex01 │ │ ├── Cards │ │ ├── 0-1.PNG │ │ ├── 0-10.PNG │ │ ├── 0-11.PNG │ │ ├── 0-12.PNG │ │ ├── 0-13.PNG │ │ ├── 0-2.PNG │ │ ├── 0-3.PNG │ │ ├── 0-4.PNG │ │ ├── 0-5.PNG │ │ ├── 0-6.PNG │ │ ├── 0-7.PNG │ │ ├── 0-8.PNG │ │ ├── 0-9.PNG │ │ ├── 1-1.PNG │ │ ├── 1-10.PNG │ │ ├── 1-11.PNG │ │ ├── 1-12.PNG │ │ ├── 1-13.PNG │ │ ├── 1-2.PNG │ │ ├── 1-3.PNG │ │ ├── 1-4.PNG │ │ ├── 1-5.PNG │ │ ├── 1-6.PNG │ │ ├── 1-7.PNG │ │ ├── 1-8.PNG │ │ ├── 1-9.PNG │ │ ├── 2-1.PNG │ │ ├── 2-10.PNG │ │ ├── 2-11.PNG │ │ ├── 2-12.PNG │ │ ├── 2-13.PNG │ │ ├── 2-2.PNG │ │ ├── 2-3.PNG │ │ ├── 2-4.PNG │ │ ├── 2-5.PNG │ │ ├── 2-6.PNG │ │ ├── 2-7.PNG │ │ ├── 2-8.PNG │ │ ├── 2-9.PNG │ │ ├── 3-1.PNG │ │ ├── 3-10.PNG │ │ ├── 3-11.PNG │ │ ├── 3-12.PNG │ │ ├── 3-13.PNG │ │ ├── 3-2.PNG │ │ ├── 3-3.PNG │ │ ├── 3-4.PNG │ │ ├── 3-5.PNG │ │ ├── 3-6.PNG │ │ ├── 3-7.PNG │ │ ├── 3-8.PNG │ │ └── 3-9.PNG │ │ ├── Ch19Ex01.csproj │ │ └── Program.cs └── Ch19Ex02 │ ├── Ch19Ex02.sln │ └── Ch19Ex02 │ ├── Ch19Ex02.csproj │ ├── Models │ └── CardGame.cs │ ├── Pages │ ├── Index.cshtml │ └── Index.cshtml.cs │ ├── Program.cs │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── Chapter20 ├── Ch20Ex01 │ ├── Ch20Ex01.sln │ └── Ch20Ex01 │ │ ├── Ch20Ex01.csproj │ │ ├── Ch20Ex01.csproj.user │ │ ├── Controllers │ │ └── HandOfCardsController.cs │ │ ├── Program.cs │ │ ├── Startup.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json ├── Ch20Ex02 │ ├── Ch20Ex02.sln │ └── Ch20Ex02 │ │ ├── App.razor │ │ ├── Ch20Ex02.csproj │ │ ├── Pages │ │ ├── Counter.razor │ │ ├── FetchData.razor │ │ └── Index.razor │ │ ├── Program.cs │ │ ├── Shared │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ ├── NavMenu.razor.css │ │ └── SurveyPrompt.razor │ │ └── _Imports.razor ├── Ch20Ex03 │ ├── Ch20Ex03.sln │ └── Ch20Ex03 │ │ ├── Ch20Ex03.csproj │ │ ├── Ch20Ex03.csproj.user │ │ ├── IService1.cs │ │ ├── Service1.svc │ │ ├── Service1.svc.cs │ │ └── Web.config ├── Ch20Ex03Client │ ├── Ch20Ex03Client.csproj │ └── Program.cs ├── Ch20Ex04 │ ├── Ch20Ex04.sln │ └── Ch20Ex04 │ │ ├── Ch20Ex04.csproj │ │ ├── Ch20Ex04.csproj.user │ │ ├── GameService.svc │ │ ├── GameService.svc.cs │ │ └── Web.config ├── Ch20Ex04Client │ ├── App.config │ ├── Ch20Ex04Client.csproj │ └── Program.cs ├── Ch20Ex04Contracts │ ├── Ch20Ex04Contracts.csproj │ ├── IGameService.cs │ └── Player.cs ├── Ch20Ex05 │ ├── Ch20Ex05.sln │ └── Ch20Ex05 │ │ ├── App.config │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── AppControlService.cs │ │ ├── Ch20Ex05.csproj │ │ ├── IAppControlService.cs │ │ ├── MainWindow.xaml │ │ └── MainWindow.xaml.cs ├── Ch20Ex05Client │ ├── App.config │ ├── Ch20Ex05Client.csproj │ └── Program.cs └── Readme.md ├── Chapter21 ├── BensCards.WPF │ ├── AboutWindow.xaml │ ├── AboutWindow.xaml.cs │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── BensCards.WPF.csproj │ ├── BensCards.WPF.csproj.user │ ├── BensCards.WPF.sln │ ├── CardControl.xaml │ ├── CardControl.xaml.cs │ ├── CardsInHandControl.xaml │ ├── CardsInHandControl.xaml.cs │ ├── ControlResources.xaml │ ├── GameClientWindow.xaml │ ├── GameClientWindow.xaml.cs │ ├── GameDecksControl.xaml │ ├── GameDecksControl.xaml.cs │ ├── GameOptions.cs │ ├── GameViewModel.cs │ ├── Images │ │ ├── Banner.png │ │ ├── Clubs.png │ │ ├── Diamonds.png │ │ ├── Hearts.png │ │ ├── Spades.png │ │ └── base_floppydisk_32.png │ ├── InversedBoolConverter.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── NumberOfPlayers.cs │ ├── OptionsWindow.xaml │ ├── OptionsWindow.xaml.cs │ ├── RankNameConverter.cs │ ├── StartGameWindow.xaml │ └── StartGameWindow.xaml.cs ├── Ch13CardLib │ ├── Card.cs │ ├── CardEventArgs.cs │ ├── CardOutOfRangeException.cs │ ├── Cards.cs │ ├── Ch13CardLib.csproj │ ├── ComputerPlayer.cs │ ├── ComputerSkillLevel.cs │ ├── Deck.cs │ ├── Player.cs │ ├── PlayerEventArgs.cs │ ├── PlayerState.cs │ ├── Rank.cs │ └── Suit.cs ├── Ch21Ex01 │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── Ch21Ex01.csproj │ ├── Ch21Ex01.sln │ ├── ImageButton.xaml │ ├── ImageButton.xaml.cs │ ├── Images │ │ └── Delete_black_32x32.png │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs └── LayoutExamples │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── Canvas.xaml │ ├── Canvas.xaml.cs │ ├── DockPanels.xaml │ ├── DockPanels.xaml.cs │ ├── LayoutExamples.csproj │ ├── LayoutExamples.csproj.user │ ├── LayoutExamples.sln │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── StackPanels.xaml │ ├── StackPanels.xaml.cs │ ├── WrapPanel.xaml │ └── WrapPanel.xaml.cs └── README.md /Chapter02/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Chapter02/ConsoleApp1/ConsoleApp1/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleApp1 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | // Output text to the screen. 10 | Console.WriteLine("The first app in Beginning C# and .NET!"); 11 | Console.ReadKey(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter02/WpfApp1/WpfApp1.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30608.117 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{567B00A8-1BA0-4E7E-90A1-10BAE8F32C76}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {567B00A8-1BA0-4E7E-90A1-10BAE8F32C76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {567B00A8-1BA0-4E7E-90A1-10BAE8F32C76}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {567B00A8-1BA0-4E7E-90A1-10BAE8F32C76}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {567B00A8-1BA0-4E7E-90A1-10BAE8F32C76}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {65B5723D-2FF6-41F1-9250-650A3B938194} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Chapter02/WpfApp1/WpfApp1/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter02/WpfApp1/WpfApp1/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace WpfApp1 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Chapter02/WpfApp1/WpfApp1/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Chapter02/WpfApp1/WpfApp1/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex02/Ch20Ex02/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Net.Http; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace Ch20Ex02 12 | { 13 | public class Program 14 | { 15 | public static async Task Main(string[] args) 16 | { 17 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 18 | builder.RootComponents.Add("#app"); 19 | 20 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 21 | 22 | await builder.Build().RunAsync(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex02/Ch20Ex02/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex02/Ch20Ex02/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 |  11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex02/Ch20Ex02/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 8 | @using Microsoft.JSInterop 9 | @using Ch20Ex02 10 | @using Ch20Ex02.Shared 11 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex03/Ch20Ex03/Service1.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="Ch20Ex03.Service1" CodeBehind="Service1.svc.cs" %> -------------------------------------------------------------------------------- /Chapter20/Ch20Ex03Client/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Ch20Ex03Client.ServiceReference1; 7 | 8 | namespace Ch20Ex03Client 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | int intParam; 15 | do 16 | { 17 | Console.WriteLine("Enter an integer and press enter to call the WCF service."); 18 | } while (!int.TryParse(Console.ReadLine(), out intParam)); 19 | Service1Client client = new Service1Client(); 20 | Console.WriteLine(client.GetData(intParam)); 21 | Console.WriteLine("Press an key to exit."); 22 | Console.ReadKey(); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex04/Ch20Ex04/GameService.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="Ch20Ex04.GameService" CodeBehind="GameService.svc.cs" %> 2 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex04Client/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex04Contracts/IGameService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.ServiceModel; 7 | 8 | namespace Ch20Ex04Contracts 9 | { 10 | [ServiceContract(SessionMode = SessionMode.Required)] 11 | public interface IGameService 12 | { 13 | [OperationContract(IsOneWay = true, IsInitiating = true)] 14 | void SetPlayerLevel(int playerLevel); 15 | [OperationContract] 16 | Player[] GetProfessionalPlayer(Player[] playerToTest); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex04Contracts/Player.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Runtime.Serialization; 7 | 8 | namespace Ch20Ex04Contracts 9 | { 10 | [DataContract] 11 | public class Player 12 | { 13 | [DataMember] 14 | public string Name { get; set; } 15 | [DataMember] 16 | public int Level { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex05/Ch20Ex05/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex05/Ch20Ex05/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace Ch20Ex05 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex05/Ch20Ex05/AppControlService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | using System.ServiceModel; 6 | using System.Text; 7 | 8 | namespace Ch20Ex05 9 | { 10 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "AppControlService" in both code and config file together. 11 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] 12 | public class AppControlService : IAppControlService 13 | { 14 | private MainWindow hostApp; 15 | public AppControlService(MainWindow hostApp) 16 | { 17 | this.hostApp = hostApp; 18 | } 19 | public void SetRadius(int radius, string foreTo, int seconds) 20 | { 21 | hostApp.SetRadius(radius, foreTo, new TimeSpan(0, 0, seconds)); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex05/Ch20Ex05/IAppControlService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | using System.ServiceModel; 6 | using System.Text; 7 | 8 | namespace Ch20Ex05 9 | { 10 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IAppControlService" in both code and config file together. 11 | [ServiceContract] 12 | public interface IAppControlService 13 | { 14 | [OperationContract] 15 | void SetRadius(int radius, string foreTo, int seconds); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Chapter20/Ch20Ex05Client/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter20/Readme.md: -------------------------------------------------------------------------------- 1 | Source code for Chapter 20 2 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/AboutWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace BensCards.WPF 16 | { 17 | /// 18 | /// Interaction logic for About.xaml 19 | /// 20 | public partial class AboutWindow : Window 21 | { 22 | public AboutWindow() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void Button_Click(object sender, RoutedEventArgs e) 28 | { 29 | this.Close(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace BensCards.WPF 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/BensCards.WPF.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net5.0-windows 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/BensCards.WPF.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Designer 7 | 8 | 9 | 10 | 11 | Designer 12 | 13 | 14 | Designer 15 | 16 | 17 | Designer 18 | 19 | 20 | Designer 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/CardsInHandControl.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/GameDecksControl.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/Images/Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/BensCards.WPF/Images/Banner.png -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/Images/Clubs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/BensCards.WPF/Images/Clubs.png -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/Images/Diamonds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/BensCards.WPF/Images/Diamonds.png -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/Images/Hearts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/BensCards.WPF/Images/Hearts.png -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/Images/Spades.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/BensCards.WPF/Images/Spades.png -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/Images/base_floppydisk_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/BensCards.WPF/Images/base_floppydisk_32.png -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/InversedBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Data; 3 | 4 | namespace BensCards.WPF 5 | { 6 | [ValueConversion(typeof(bool), typeof(bool))] 7 | public class InversedBoolConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, 10 | System.Globalization.CultureInfo culture) 11 | { 12 | return !(bool)value; 13 | } 14 | public object ConvertBack(object value, Type targetType, object parameter, 15 | System.Globalization.CultureInfo culture) 16 | { 17 | return !(bool)value; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace BensCards.WPF 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Chapter21/BensCards.WPF/NumberOfPlayers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | 3 | namespace BensCards.WPF 4 | { 5 | public class NumberOfPlayers : ObservableCollection 6 | { 7 | public NumberOfPlayers() 8 | : base() 9 | { 10 | Add(2); 11 | Add(3); 12 | Add(4); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/CardEventArgs.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 Ch13CardLib 8 | { 9 | public class CardEventArgs : EventArgs 10 | { 11 | public Card Card { get; set; } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/CardOutOfRangeException.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 Ch13CardLib 8 | { 9 | public class CardOutOfRangeException : Exception 10 | { 11 | private Cards deckContents; 12 | public Cards DeckContents 13 | { 14 | get { return deckContents; } 15 | } 16 | public CardOutOfRangeException(Cards sourceDeckContents) 17 | : base("There are only 52 cards in the deck.") 18 | { 19 | deckContents = sourceDeckContents; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/Cards.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Ch13CardLib 9 | { 10 | public class Cards : List, ICloneable 11 | { 12 | /// 13 | /// Utility method for copying card instances into another Cards 14 | /// instance—used in Deck.Shuffle(). This implementation assumes that 15 | /// source and target collections are the same size. 16 | /// 17 | public void CopyTo(Cards targetCards) 18 | { 19 | for (int index = 0; index < this.Count; index++) 20 | { 21 | targetCards[index] = this[index]; 22 | } 23 | } 24 | 25 | public object Clone() 26 | { 27 | Cards newCards = new Cards(); 28 | foreach (Card sourceCard in this) 29 | { 30 | newCards.Add((Card)sourceCard.Clone()); 31 | } 32 | return newCards; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/Ch13CardLib.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/ComputerSkillLevel.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 Ch13CardLib 8 | { 9 | [Serializable] 10 | public enum ComputerSkillLevel 11 | { 12 | Dumb, 13 | Good, 14 | Cheats 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/PlayerEventArgs.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 Ch13CardLib 8 | { 9 | public class PlayerEventArgs : EventArgs 10 | { 11 | public Player Player { get; set; } 12 | public PlayerState State { get; set; } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/PlayerState.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 Ch13CardLib 8 | { 9 | [Serializable] 10 | public enum PlayerState 11 | { 12 | Inactive, 13 | Active, 14 | MustDiscard, 15 | Winner, 16 | Loser 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/Rank.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Ch13CardLib 7 | { 8 | public enum Rank 9 | { 10 | Ace = 1, 11 | Deuce, 12 | Three, 13 | Four, 14 | Five, 15 | Six, 16 | Seven, 17 | Eight, 18 | Nine, 19 | Ten, 20 | Jack, 21 | Queen, 22 | King, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter21/Ch13CardLib/Suit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Ch13CardLib 7 | { 8 | public enum Suit 9 | { 10 | Club, 11 | Diamond, 12 | Heart, 13 | Spade, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace Ch21Ex01 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/Ch21Ex01.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net5.0-windows 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/Ch21Ex01.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31005.135 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ch21Ex01", "Ch21Ex01.csproj", "{989115EE-B6A0-4920-AA1A-B87C9A9EEB7A}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {989115EE-B6A0-4920-AA1A-B87C9A9EEB7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {989115EE-B6A0-4920-AA1A-B87C9A9EEB7A}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {989115EE-B6A0-4920-AA1A-B87C9A9EEB7A}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {989115EE-B6A0-4920-AA1A-B87C9A9EEB7A}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {958F9892-41F3-4B79-9670-6EEF254AB582} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/ImageButton.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/ImageButton.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace Ch21Ex01 16 | { 17 | /// 18 | /// Interaction logic for ImageButton.xaml 19 | /// 20 | public partial class ImageButton : Window 21 | { 22 | public ImageButton() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter21/Ch21Ex01/Images/Delete_black_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benperk/BeginningCSharpAndDotNET/b19568e92704db72c0274fa60f69dffbf822275a/Chapter21/Ch21Ex01/Images/Delete_black_32x32.png -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace LayoutExamples 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/Canvas.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 12 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/Canvas.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace LayoutExamples 16 | { 17 | /// 18 | /// Interaction logic for Canvas.xaml 19 | /// 20 | public partial class Canvas : Window 21 | { 22 | public Canvas() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/DockPanels.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace LayoutExamples 16 | { 17 | /// 18 | /// Interaction logic for DockPanels.xaml 19 | /// 20 | public partial class DockPanels : Window 21 | { 22 | public DockPanels() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/LayoutExamples.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net5.0-windows 6 | true 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/LayoutExamples.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Designer 7 | 8 | 9 | 10 | 11 | Designer 12 | 13 | 14 | Designer 15 | 16 | 17 | Designer 18 | 19 | 20 | Designer 21 | 22 | 23 | Designer 24 | 25 | 26 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/LayoutExamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31112.23 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LayoutExamples", "LayoutExamples.csproj", "{52506F8C-1CEE-4892-881C-2FBD92FDDE16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {52506F8C-1CEE-4892-881C-2FBD92FDDE16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {52506F8C-1CEE-4892-881C-2FBD92FDDE16}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {52506F8C-1CEE-4892-881C-2FBD92FDDE16}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {52506F8C-1CEE-4892-881C-2FBD92FDDE16}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {F232DFFF-A974-4E16-9BA9-7F89FD92F09A} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LayoutExamples 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/StackPanels.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace LayoutExamples 16 | { 17 | /// 18 | /// Interaction logic for StackPanels.xaml 19 | /// 20 | public partial class StackPanels : Window 21 | { 22 | public StackPanels() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/WrapPanel.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 12 | 14 | 16 | 18 | 19 | -------------------------------------------------------------------------------- /Chapter21/LayoutExamples/WrapPanel.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace LayoutExamples 16 | { 17 | /// 18 | /// Interaction logic for WrapPanel.xaml 19 | /// 20 | public partial class WrapPanel : Window 21 | { 22 | public WrapPanel() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | --------------------------------------------------------------------------------