├── Chapter01
└── Note.txt
├── Chapter03
└── Note.txt
├── Chapter21
└── Note.txt
├── Chapter23
└── Note.txt
├── LICENSE.txt
├── 9781430242789.jpg
├── Chapter02
├── Page16
│ ├── Page16
│ │ ├── Program.cs
│ │ └── App.config
│ └── Page16.sln
└── Page27
│ ├── Page27
│ ├── App.config
│ └── Program.cs
│ └── Page27.sln
├── Chapter04
├── Page064
│ ├── Page064
│ │ ├── App.config
│ │ └── Program.cs
│ └── Page064.sln
└── Page065
│ ├── Page065
│ └── App.config
│ └── Page065.sln
├── Chapter05
├── Page075
│ ├── Page075
│ │ ├── App.config
│ │ └── Program.cs
│ └── Page075.sln
├── Page077
│ ├── Page077
│ │ ├── App.config
│ │ └── Program.cs
│ └── Page077.sln
├── Page079
│ ├── Page079
│ │ ├── App.config
│ │ └── Program.cs
│ └── Page079.sln
├── Page082
│ ├── Page082
│ │ ├── App.config
│ │ └── Program.cs
│ └── Page082.sln
├── Page084
│ └── Page084
│ │ ├── App.config
│ │ └── Program.cs
├── Page087
│ └── Page087
│ │ ├── App.config
│ │ └── Program.cs
├── Page089
│ └── Page089
│ │ ├── App.config
│ │ └── Program.cs
├── Page091
│ └── Page091
│ │ ├── App.config
│ │ └── Program.cs
├── Page094
│ └── Page094
│ │ ├── App.config
│ │ └── Program.cs
├── Page098
│ └── Page098
│ │ ├── App.config
│ │ └── Program.cs
├── Page100
│ └── Page100
│ │ ├── App.config
│ │ └── Program.cs
├── Page103
│ └── Page103
│ │ ├── App.config
│ │ └── Program.cs
├── Page104
│ └── Page104
│ │ ├── App.config
│ │ └── Program.cs
├── Page106
│ └── Page106
│ │ ├── App.config
│ │ └── Program.cs
├── Page107
│ └── Page107
│ │ ├── App.config
│ │ └── Program.cs
├── Page108
│ └── Page108
│ │ ├── App.config
│ │ └── Program.cs
└── Page110
│ └── Page110
│ ├── App.config
│ └── Program.cs
├── Chapter06
├── Page116
│ └── Page116
│ │ ├── App.config
│ │ └── Program.cs
├── Page118
│ └── Page118
│ │ ├── App.config
│ │ └── Program.cs
├── Page119
│ └── Page119
│ │ ├── App.config
│ │ └── Program.cs
├── Page120
│ └── Page120
│ │ ├── App.config
│ │ └── Program.cs
├── Page123
│ └── Page123
│ │ ├── App.config
│ │ └── Program.cs
├── Page128
│ └── Page128
│ │ ├── App.config
│ │ └── Program.cs
├── Page132
│ └── Page132
│ │ ├── App.config
│ │ └── Program.cs
├── Page133
│ └── Page133
│ │ ├── App.config
│ │ └── Program.cs
├── Page134
│ └── Page134
│ │ ├── App.config
│ │ └── Program.cs
├── Page136
│ └── Page136
│ │ ├── App.config
│ │ └── Program.cs
├── Page139
│ └── Page139
│ │ ├── App.config
│ │ └── Program.cs
├── Page141
│ └── Page141
│ │ ├── App.config
│ │ └── Program.cs
├── Page144
│ └── Page144
│ │ ├── App.config
│ │ └── Program.cs
├── Page150
│ └── Page150
│ │ └── App.config
├── Page151
│ └── Page151
│ │ └── App.config
├── Page153
│ └── Page153
│ │ ├── App.config
│ │ └── Program.cs
└── Page157
│ └── Page157
│ ├── App.config
│ └── Program.cs
├── Chapter07
├── Page161
│ └── Page161
│ │ └── App.config
├── Page164
│ └── Page164
│ │ ├── App.config
│ │ └── Program.cs
├── Page165
│ └── Page165
│ │ ├── App.config
│ │ └── Program.cs
├── Page167
│ └── Page167
│ │ ├── App.config
│ │ └── Program.cs
├── Page169
│ └── Page169
│ │ ├── App.config
│ │ └── Program.cs
├── Page171
│ └── Page171
│ │ ├── App.config
│ │ └── Program.cs
├── Page172
│ └── Page172
│ │ ├── App.config
│ │ └── Program.cs
├── Page173
│ └── Page173
│ │ ├── App.config
│ │ └── Program.cs
├── Page180
│ ├── Assembly1
│ │ ├── App.config
│ │ └── Assembly1.cs
│ ├── Assembly2
│ │ ├── App.config
│ │ └── Assembly2.cs
│ └── Page180
│ │ ├── App.config
│ │ └── Program.cs
├── Page191
│ └── Page191
│ │ └── App.config
├── Page192
│ └── Page192
│ │ └── App.config
├── Page194
│ └── Page194
│ │ ├── App.config
│ │ └── Program.cs
├── Page196
│ └── Page196
│ │ ├── App.config
│ │ └── Program.cs
└── Page198
│ └── Page198
│ ├── App.config
│ └── Program.cs
├── Chapter08
├── Page203
│ └── Page203
│ │ ├── App.config
│ │ └── Program.cs
├── Page208
│ └── Page208
│ │ └── App.config
├── Page213
│ └── Page213
│ │ ├── App.config
│ │ └── Program.cs
├── Page214
│ └── Page214
│ │ ├── App.config
│ │ └── Program.cs
├── Page217
│ └── Page217
│ │ ├── App.config
│ │ └── Program.cs
├── Page221
│ └── Page221
│ │ ├── App.config
│ │ └── Program.cs
├── Page223
│ └── Page223
│ │ ├── App.config
│ │ └── Program.cs
├── Page227
│ └── Page227
│ │ ├── App.config
│ │ └── Program.cs
├── Page230
│ └── Page230
│ │ └── App.config
├── Page231
│ └── Page231
│ │ └── App.config
├── Page234
│ └── Page234
│ │ └── App.config
├── Page236
│ └── Page236
│ │ ├── App.config
│ │ └── Program.cs
└── Page237
│ └── Page237
│ ├── App.config
│ └── Program.cs
├── Chapter09
├── Page245
│ └── Page245
│ │ ├── App.config
│ │ └── Program.cs
├── Page247
│ └── Page247
│ │ ├── App.config
│ │ └── Program.cs
├── Page249
│ └── Page249
│ │ ├── App.config
│ │ └── Program.cs
├── Page251
│ └── Page251
│ │ ├── App.config
│ │ └── Program.cs
├── Page254
│ └── Page254
│ │ └── App.config
├── Page255
│ └── Page255
│ │ ├── App.config
│ │ └── Program.cs
├── Page258
│ └── Page258
│ │ └── App.config
└── Page264
│ └── Page264
│ ├── App.config
│ └── Program.cs
├── Chapter10
├── Page270
│ └── Page270
│ │ ├── App.config
│ │ └── Program.cs
└── Page272
│ └── Page272
│ ├── App.config
│ └── Program.cs
├── Chapter11
├── Page280
│ └── Page280
│ │ ├── App.config
│ │ └── Program.cs
├── Page281
│ └── Page281
│ │ ├── App.config
│ │ └── Program.cs
├── Page287
│ └── Page287
│ │ ├── App.config
│ │ └── Program.cs
├── Page288
│ └── Page288
│ │ └── App.config
└── Page291
│ └── Page291
│ ├── App.config
│ └── Program.cs
├── Chapter12
├── Page299
│ └── Page299
│ │ ├── App.config
│ │ └── Program.cs
├── Page304
│ └── Page304
│ │ ├── App.config
│ │ └── Program.cs
├── Page308
│ └── Page308
│ │ └── App.config
├── Page312
│ └── Page312
│ │ ├── App.config
│ │ └── Program.cs
├── Page313
│ └── Page313
│ │ ├── App.config
│ │ └── Program.cs
├── Page314
│ └── Page314
│ │ ├── App.config
│ │ └── Program.cs
├── Page315
│ └── Page315
│ │ ├── App.config
│ │ └── Program.cs
└── Page318
│ └── Page318
│ ├── App.config
│ └── Program.cs
├── Chapter13
├── Page325
│ └── Page325
│ │ └── App.config
├── Page336
│ └── Page336
│ │ └── App.config
├── Page337
│ └── Page337
│ │ ├── App.config
│ │ └── Program.cs
├── Page338
│ └── Page338
│ │ ├── App.config
│ │ └── Program.cs
├── Page339a
│ └── Page339a
│ │ ├── App.config
│ │ └── Program.cs
├── Page339b
│ └── Page339b
│ │ ├── App.config
│ │ └── Program.cs
├── Page342a
│ └── Page342a
│ │ ├── App.config
│ │ └── Program.cs
├── Page342b
│ └── Page342b
│ │ ├── App.config
│ │ └── Program.cs
├── Page343
│ └── Page343
│ │ ├── App.config
│ │ └── Program.cs
└── Page345
│ └── Page345
│ ├── App.config
│ └── Program.cs
├── Chapter14
├── Page355
│ └── Page355
│ │ └── App.config
├── Page357
│ └── Page357
│ │ └── App.config
├── Page358
│ └── Page358
│ │ └── App.config
└── Page360
│ └── Page360
│ ├── App.config
│ └── Program.cs
├── Chapter15
├── Page365
│ └── Page365
│ │ └── App.config
├── Page366
│ └── Page366
│ │ ├── App.config
│ │ └── Program.cs
├── Page369
│ └── Page369
│ │ └── App.config
├── Page373
│ └── Page373
│ │ ├── App.config
│ │ └── Program.cs
├── Page375
│ └── Page375
│ │ ├── App.config
│ │ └── Program.cs
├── Page377
│ └── Page377
│ │ ├── App.config
│ │ └── Program.cs
├── Page378
│ └── Page378
│ │ ├── App.config
│ │ └── Program.cs
├── Page380
│ └── Page380
│ │ ├── App.config
│ │ └── Program.cs
├── Page384
│ └── Page384
│ │ └── App.config
└── Page388
│ └── Page388
│ └── App.config
├── Chapter16
├── Page395
│ └── Page395
│ │ ├── App.config
│ │ └── Program.cs
├── Page398
│ └── Page398
│ │ ├── App.config
│ │ └── Program.cs
├── Page410
│ └── Page410
│ │ ├── App.config
│ │ └── Program.cs
├── Page411
│ └── Page411
│ │ ├── App.config
│ │ └── Program.cs
├── Page414
│ └── Page414
│ │ ├── App.config
│ │ └── Program.cs
└── Page417
│ └── Page417
│ ├── App.config
│ └── Program.cs
├── Chapter17
├── Page431
│ └── Page431
│ │ └── App.config
├── Page441
│ └── Page441
│ │ └── App.config
├── Page442
│ └── Page442
│ │ ├── App.config
│ │ └── Program.cs
├── Page443
│ └── Page443
│ │ ├── App.config
│ │ └── Program.cs
├── Page445
│ └── Page445
│ │ ├── App.config
│ │ └── Program.cs
├── Page446
│ └── Page446
│ │ ├── App.config
│ │ └── Program.cs
├── Page447
│ └── Page447
│ │ ├── App.config
│ │ └── Program.cs
├── Page448
│ └── Page448
│ │ ├── App.config
│ │ └── Program.cs
├── Page450
│ └── Page450
│ │ ├── App.config
│ │ └── Program.cs
├── Page454
│ └── Page454
│ │ ├── App.config
│ │ └── Program.cs
└── Page458
│ └── Page458
│ ├── App.config
│ └── Program.cs
├── Chapter18
├── Page466
│ └── Page466
│ │ ├── App.config
│ │ └── Program.cs
├── Page468
│ └── Page468
│ │ └── App.config
├── Page474
│ └── Page474
│ │ ├── App.config
│ │ └── Program.cs
├── Page476
│ └── Page476
│ │ ├── App.config
│ │ └── Program.cs
├── Page479
│ └── Page479
│ │ ├── App.config
│ │ └── Program.cs
└── Page480
│ └── Page480
│ └── App.config
├── Chapter19
├── Page484
│ └── Page484
│ │ ├── App.config
│ │ └── Program.cs
├── Page486
│ └── Page486
│ │ ├── App.config
│ │ └── Program.cs
├── Page487
│ └── Page487
│ │ ├── App.config
│ │ └── Program.cs
├── Page489
│ └── Page489
│ │ ├── App.config
│ │ └── Program.cs
├── Page492
│ └── Page492
│ │ ├── App.config
│ │ └── Program.cs
├── Page497
│ └── Page497
│ │ └── App.config
├── Page499
│ └── Page499
│ │ ├── App.config
│ │ └── Program.cs
├── Page500
│ └── Page500
│ │ ├── App.config
│ │ └── Program.cs
├── Page501
│ └── Page501
│ │ ├── App.config
│ │ └── Program.cs
├── Page502
│ └── Page502
│ │ ├── App.config
│ │ └── Program.cs
├── Page504
│ └── Page504
│ │ ├── App.config
│ │ └── Program.cs
├── Page505
│ └── Page505
│ │ ├── App.config
│ │ └── Program.cs
├── Page506
│ └── Page506
│ │ ├── App.config
│ │ └── Program.cs
├── Page508
│ └── Page508
│ │ ├── App.config
│ │ └── Program.cs
├── Page509
│ └── Page509
│ │ ├── App.config
│ │ └── Program.cs
├── Page514
│ └── Page514
│ │ ├── App.config
│ │ └── Program.cs
├── Page515
│ └── Page515
│ │ ├── App.config
│ │ └── Program.cs
├── Page516
│ └── Page516
│ │ ├── App.config
│ │ └── Program.cs
├── Page518
│ └── Page518
│ │ ├── App.config
│ │ └── Program.cs
├── Page519
│ └── Page519
│ │ ├── App.config
│ │ └── Program.cs
├── Page525
│ └── Page525
│ │ └── App.config
├── Page526
│ └── Page526
│ │ ├── App.config
│ │ └── Program.cs
├── Page529
│ └── Page529
│ │ └── App.config
├── Page530
│ └── Page530
│ │ └── App.config
├── Page532
│ └── Page532
│ │ ├── App.config
│ │ └── Program.cs
├── Page533
│ └── Page533
│ │ └── App.config
├── Page534
│ └── Page534
│ │ ├── App.config
│ │ └── Program.cs
├── Page535
│ └── Page535
│ │ ├── App.config
│ │ └── Program.cs
├── Page537
│ └── Page537
│ │ ├── App.config
│ │ └── Program.cs
├── Page538
│ └── Page538
│ │ ├── App.config
│ │ └── Program.cs
├── Page539
│ └── Page539
│ │ ├── App.config
│ │ └── SimpleSample.xml
└── Page540
│ └── Page540
│ ├── App.config
│ ├── SimpleSample.xml
│ └── Program.cs
├── Chapter20
├── Page543
│ └── Page543
│ │ └── App.config
├── Page545
│ └── Page545
│ │ └── App.config
├── Page556
│ └── Page556
│ │ ├── App.config
│ │ └── Program.cs
├── Page558
│ └── Page558
│ │ ├── App.config
│ │ └── Program.cs
├── Page559
│ └── Page559
│ │ ├── App.config
│ │ └── Program.cs
├── Page560
│ └── Page560
│ │ └── App.config
├── Page562
│ └── Page562
│ │ ├── App.config
│ │ └── Program.cs
├── Page563
│ └── Page563
│ │ ├── App.config
│ │ └── Program.cs
├── Page564
│ └── Page564
│ │ └── App.config
├── Page567
│ └── Page567
│ │ └── App.config
├── Page569
│ └── Page569
│ │ ├── App.config
│ │ └── Program.cs
├── Page574
│ └── Page574
│ │ ├── App.config
│ │ └── Program.cs
├── Page586
│ └── Page586
│ │ ├── App.config
│ │ └── Program.cs
├── Page587
│ └── Page587
│ │ ├── App.config
│ │ └── Program.cs
├── Page588
│ └── Page588
│ │ ├── App.config
│ │ └── Program.cs
├── Page593
│ └── Page593
│ │ ├── App.config
│ │ └── Program.cs
├── Page595
│ └── Page595
│ │ └── App.config
├── Page599
│ └── Page599
│ │ └── App.config
├── Page601
│ └── Page601
│ │ ├── App.config
│ │ └── Program.cs
├── WpfAwait
│ └── WpfAwait
│ │ ├── App.config
│ │ ├── Properties
│ │ └── Settings.settings
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ └── MainWindow.xaml
├── AsyncLambda
│ └── AsyncLambda
│ │ ├── App.config
│ │ ├── Properties
│ │ └── Settings.settings
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
├── MessagePump
│ └── MessagePump
│ │ ├── App.config
│ │ ├── Properties
│ │ └── Settings.settings
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ └── MainWindow.xaml
└── SimpleWorker
│ └── SimpleWorker
│ ├── App.config
│ ├── Properties
│ └── Settings.settings
│ ├── App.xaml
│ ├── App.xaml.cs
│ └── MainWindow.xaml
├── Chapter22
├── Page634
│ └── Page634
│ │ ├── App.config
│ │ └── Program.cs
├── Page638
│ └── Page638
│ │ ├── App.config
│ │ └── Program.cs
├── Page640
│ └── Page640
│ │ ├── App.config
│ │ └── Program.cs
├── Page644
│ └── Page644
│ │ └── App.config
├── Page647
│ └── Page647
│ │ ├── App.config
│ │ └── Program.cs
└── Page648
│ └── Page648
│ ├── App.config
│ └── Program.cs
├── Chapter24
├── Page666
│ └── Page666
│ │ ├── App.config
│ │ └── Program.cs
├── Page668
│ └── Page668
│ │ ├── App.config
│ │ └── Program.cs
├── Page671
│ └── Page671
│ │ ├── App.config
│ │ └── Program.cs
├── Page673
│ └── Page673
│ │ ├── App.config
│ │ └── Program.cs
├── Page674
│ └── Page674
│ │ ├── App.config
│ │ └── Program.cs
├── Page675
│ └── Page675
│ │ ├── App.config
│ │ └── Program.cs
├── Page687
│ └── Page687
│ │ └── App.config
└── Page688
│ └── Page688
│ └── App.config
├── Chapter25
├── Page693
│ └── Page693
│ │ ├── App.config
│ │ └── Program.cs
├── Page694
│ └── Page694
│ │ ├── App.config
│ │ └── Program.cs
├── Page695
│ └── Page695
│ │ ├── App.config
│ │ └── Program.cs
├── Page696
│ └── Page696
│ │ ├── App.config
│ │ └── Program.cs
├── Page699
│ └── Page699
│ │ ├── App.config
│ │ └── Program.cs
├── Page700
│ └── Page700
│ │ ├── App.config
│ │ └── Program.cs
├── Page703
│ └── Page703
│ │ ├── App.config
│ │ └── Program.cs
├── Page709
│ └── Page709
│ │ └── App.config
├── Page711
│ └── Page711
│ │ └── App.config
└── Page717
│ └── Page717
│ └── App.config
├── README.md
└── contributing.md
/Chapter01/Note.txt:
--------------------------------------------------------------------------------
1 | There are no programs in this chapter.
--------------------------------------------------------------------------------
/Chapter03/Note.txt:
--------------------------------------------------------------------------------
1 | There are no programs in this chapter.
--------------------------------------------------------------------------------
/Chapter21/Note.txt:
--------------------------------------------------------------------------------
1 | There are no programs in this chapter.
--------------------------------------------------------------------------------
/Chapter23/Note.txt:
--------------------------------------------------------------------------------
1 | There are no programs in this chapter.
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Apress/illustrated-csharp-2012/HEAD/LICENSE.txt
--------------------------------------------------------------------------------
/9781430242789.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Apress/illustrated-csharp-2012/HEAD/9781430242789.jpg
--------------------------------------------------------------------------------
/Chapter02/Page16/Page16/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | Console.WriteLine( "Hi there!" );
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Chapter02/Page16/Page16/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter02/Page27/Page27/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter04/Page064/Page064/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter04/Page065/Page065/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page075/Page075/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page077/Page077/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page079/Page079/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page082/Page082/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page084/Page084/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page087/Page087/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page089/Page089/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page091/Page091/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page094/Page094/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page098/Page098/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page100/Page100/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page103/Page103/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page104/Page104/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page106/Page106/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page107/Page107/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page108/Page108/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter05/Page110/Page110/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page116/Page116/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page118/Page118/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page119/Page119/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page120/Page120/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page123/Page123/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page128/Page128/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page132/Page132/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page133/Page133/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page134/Page134/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page136/Page136/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page139/Page139/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page141/Page141/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page144/Page144/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page150/Page150/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page151/Page151/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page153/Page153/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter06/Page157/Page157/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page161/Page161/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page164/Page164/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page165/Page165/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page167/Page167/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page169/Page169/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page171/Page171/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page172/Page172/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page173/Page173/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page180/Assembly1/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page180/Assembly2/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page180/Page180/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page191/Page191/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page192/Page192/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page194/Page194/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page196/Page196/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter07/Page198/Page198/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page203/Page203/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page208/Page208/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page213/Page213/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page214/Page214/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page217/Page217/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page221/Page221/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page223/Page223/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page227/Page227/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page230/Page230/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page231/Page231/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page234/Page234/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page236/Page236/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter08/Page237/Page237/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page245/Page245/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page247/Page247/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page249/Page249/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page251/Page251/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page254/Page254/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page255/Page255/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page258/Page258/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page264/Page264/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter10/Page270/Page270/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter10/Page272/Page272/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter11/Page280/Page280/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter11/Page281/Page281/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter11/Page287/Page287/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter11/Page288/Page288/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter11/Page291/Page291/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page299/Page299/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page304/Page304/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page308/Page308/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page312/Page312/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page313/Page313/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page314/Page314/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page315/Page315/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter12/Page318/Page318/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page325/Page325/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page336/Page336/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page337/Page337/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page338/Page338/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page339a/Page339a/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page339b/Page339b/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page342a/Page342a/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page342b/Page342b/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page343/Page343/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter13/Page345/Page345/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter14/Page355/Page355/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter14/Page357/Page357/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter14/Page358/Page358/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter14/Page360/Page360/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page365/Page365/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page366/Page366/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page369/Page369/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page373/Page373/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page375/Page375/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page377/Page377/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page378/Page378/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page380/Page380/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page384/Page384/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter15/Page388/Page388/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter16/Page395/Page395/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter16/Page398/Page398/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter16/Page410/Page410/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter16/Page411/Page411/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter16/Page414/Page414/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter16/Page417/Page417/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page431/Page431/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page441/Page441/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page442/Page442/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page443/Page443/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page445/Page445/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page446/Page446/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page447/Page447/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page448/Page448/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page450/Page450/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page454/Page454/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter17/Page458/Page458/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter18/Page466/Page466/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter18/Page468/Page468/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter18/Page474/Page474/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter18/Page476/Page476/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter18/Page479/Page479/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter18/Page480/Page480/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page484/Page484/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page486/Page486/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page487/Page487/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page489/Page489/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page492/Page492/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page497/Page497/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page499/Page499/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page500/Page500/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page501/Page501/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page502/Page502/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page504/Page504/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page505/Page505/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page506/Page506/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page508/Page508/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page509/Page509/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page514/Page514/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page515/Page515/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page516/Page516/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page518/Page518/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page519/Page519/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page525/Page525/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page526/Page526/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page529/Page529/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page530/Page530/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page532/Page532/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page533/Page533/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page534/Page534/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page535/Page535/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page537/Page537/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page538/Page538/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page539/Page539/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page540/Page540/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page543/Page543/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page545/Page545/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page556/Page556/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page558/Page558/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page559/Page559/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page560/Page560/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page562/Page562/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page563/Page563/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page564/Page564/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page567/Page567/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page569/Page569/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page574/Page574/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page586/Page586/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page587/Page587/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page588/Page588/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page593/Page593/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page595/Page595/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page599/Page599/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/Page601/Page601/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/WpfAwait/WpfAwait/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter22/Page634/Page634/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter22/Page638/Page638/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter22/Page640/Page640/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter22/Page644/Page644/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter22/Page647/Page647/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter22/Page648/Page648/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page666/Page666/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page668/Page668/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page671/Page671/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page673/Page673/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page674/Page674/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page675/Page675/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page687/Page687/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter24/Page688/Page688/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page693/Page693/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page694/Page694/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page695/Page695/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page696/Page696/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page699/Page699/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page700/Page700/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page703/Page703/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page703/Page703/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( string[] args )
6 | {
7 | foreach ( string s in args )
8 | Console.WriteLine( s );
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Chapter25/Page709/Page709/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page711/Page711/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter25/Page717/Page717/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page539/Page539/SimpleSample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter19/Page540/Page540/SimpleSample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/AsyncLambda/AsyncLambda/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/MessagePump/MessagePump/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter20/SimpleWorker/SimpleWorker/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/Page247/Page247/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int x = 0;
8 | do
9 | Console.WriteLine( "x is {0}", x++ );
10 | while ( x < 3 );
11 | }
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/Chapter20/WpfAwait/WpfAwait/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Chapter07/Page180/Assembly1/Assembly1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace BaseClassNS
4 | {
5 | public class MyBaseClass
6 | {
7 | public void PrintMe()
8 | {
9 | Console.WriteLine( "I am MyBaseClass" );
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Chapter20/AsyncLambda/AsyncLambda/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Chapter20/MessagePump/MessagePump/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Chapter20/SimpleWorker/SimpleWorker/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Chapter08/Page214/Page214/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( )
6 | {
7 | int x = 5, y = 4;
8 | Console.WriteLine( "x == x is {0}", x == x );
9 | Console.WriteLine( "x == y is {0}", x == y );
10 | }
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/Chapter08/Page237/Page237/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class SomeClass
4 | {
5 | }
6 |
7 | class Program
8 | {
9 | static void Main()
10 | {
11 | SomeClass s = new SomeClass();
12 | Console.WriteLine( "Type s: {0}", s.GetType().Name );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter06/Page123/Page123/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class X
4 | {
5 | public const double PI = 3.1416;
6 | }
7 |
8 | class Program
9 | {
10 | static void Main()
11 | {
12 | Console.WriteLine( "pi = {0}", X.PI ); // Use static field PI
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter06/Page119/Page119/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class D
4 | {
5 | int Mem1;
6 | static public int Mem2;
7 | }
8 |
9 | class Program
10 | {
11 | static void Main()
12 | {
13 | D.Mem2 = 5;
14 | Console.WriteLine( "Mem2 = {0}", D.Mem2 );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter12/Page312/Page312/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( string[] args )
6 | {
7 | int[] arr1 = { 10, 11, 12, 13 };
8 |
9 | foreach ( int item in arr1 )
10 | Console.WriteLine( "Item Value: {0}", item );
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Chapter07/Page180/Page180/Program.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 Page180
8 | {
9 | class Program
10 | {
11 | static void Main( string[] args )
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Chapter09/Page245/Page245/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( string[] args )
6 | {
7 | int x = 3;
8 | while ( x > 0 )
9 | {
10 | Console.WriteLine( "x: {0}", x );
11 | x--;
12 | }
13 | Console.WriteLine( "Out of loop" );
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Chapter09/Page249/Page249/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | // The body of this for loop is executed three times.
8 | for ( int i=0; i < 3; i++ )
9 | Console.WriteLine( "Inside loop. i: {0}", i );
10 |
11 | Console.WriteLine( "Out of Loop" );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/Chapter13/Page342b/Page342b/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | delegate void MyDel( int x );
6 |
7 | static void Main()
8 | {
9 | int x = 5;
10 |
11 | MyDel mDel = delegate
12 | {
13 | Console.WriteLine( "{0}", x );
14 | };
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Chapter16/Page411/Page411/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Page411
4 | {
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | int i = 10;
10 |
11 | object oi = i;
12 |
13 | int j = (int) oi;
14 | Console.WriteLine( "i: {0}, oi: {1}, j: {2}", i, oi, j );
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter19/Page516/Page516/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | int[] intArray = new int[] { 3, 4, 5, 6, 7, 9 };
9 | var countOdd = intArray.Count( n => n % 2 == 1 );
10 |
11 | Console.WriteLine( "Count of odd numbers: {0}", countOdd );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/Chapter19/Page519/Page519/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | int[] intArray = new int[] { 3, 4, 5, 6, 7, 9 };
9 |
10 | var countOdd = intArray.Count( x => x % 2 == 1 );
11 | Console.WriteLine( "Count of odd numbers: {0}", countOdd );
12 | }
13 | }
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Chapter20/WpfAwait/WpfAwait/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chapter06/Page116/Page116/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class D
4 | {
5 | public int Mem1;
6 | }
7 |
8 | class Program
9 | {
10 | static void Main()
11 | {
12 | D d1 = new D();
13 | D d2 = new D();
14 | d1.Mem1 = 10;
15 | d2.Mem1 = 28;
16 |
17 | Console.WriteLine( "d1 = {0}, d2 = {1}", d1.Mem1, d2.Mem1 );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter20/AsyncLambda/AsyncLambda/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chapter20/MessagePump/MessagePump/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chapter20/Page586/Page586/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks; // Must use this namespace
3 |
4 | namespace ExampleParallelFor
5 | {
6 | class Program
7 | {
8 | static void Main()
9 | {
10 | Parallel.For( 0, 15, i =>
11 | Console.WriteLine( "The square of {0} is {1}", i, i * i ) );
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Chapter20/SimpleWorker/SimpleWorker/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chapter09/Page251/Page251/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Page251
4 | {
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | const int MaxI = 5;
10 |
11 | for ( int i = 0, j = 10; i < MaxI; i++, j += 10 )
12 | {
13 | Console.WriteLine( "{0}, {1}", i, j );
14 | }
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter19/Page509/Page509/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static int[] numbers = new int[] { 2, 4, 6 };
7 |
8 | static void Main()
9 | {
10 | int total = numbers.Sum();
11 | int howMany = numbers.Count();
12 |
13 | Console.WriteLine( "Total: {0}, Count: {1}", total, howMany );
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Chapter19/Page486/Page486/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | var student = new { Name = "Mary Jones", Age = 19, Major = "History" };
10 |
11 | Console.WriteLine( "{0}, Age {1}, Major: {2}", student.Name, student.Age, student.Major );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/Chapter07/Page180/Assembly2/Assembly2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using BaseClassNS;
3 |
4 | namespace UsesBaseClass
5 | {
6 | class DerivedClass : MyBaseClass
7 | {
8 | // Empty body
9 | }
10 |
11 | class Program
12 | {
13 | static void Main()
14 | {
15 | DerivedClass mdc = new DerivedClass();
16 | mdc.PrintMe();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter16/Page395/Page395/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | ushort sh = 10;
8 | byte sb = (byte) sh;
9 | Console.WriteLine
10 | ( "sb: {0} = 0x{0:X}", sb );
11 |
12 | sh = 1365;
13 | sb = (byte) sh;
14 | Console.WriteLine
15 | ( "sb: {0} = 0x{0:X}", sb );
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter13/Page339b/Page339b/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | delegate int OtherDel(int InParam);
6 |
7 | static void Main()
8 | {
9 | OtherDel del = delegate(int x)
10 | {
11 | return x + 20;
12 | };
13 | Console.WriteLine("{0}", del(5));
14 | Console.WriteLine("{0}", del(6));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter12/Page314/Page314/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int total = 0;
8 | int[,] arr1 = { { 10, 11 }, { 12, 13 } };
9 |
10 | foreach ( var element in arr1 )
11 | {
12 | total += element;
13 | Console.WriteLine( "Element: {0}, Current Total: {1}", element, total );
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter17/Page450/Page450/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Animal
4 | {
5 | public int NumberOfLegs = 4;
6 | }
7 |
8 | class Dog : Animal
9 | {
10 | }
11 |
12 | class Program
13 | {
14 | static void Main()
15 | {
16 | Animal a1 = new Animal();
17 | Animal a2 = new Dog();
18 |
19 | Console.WriteLine( "Number of dog legs: {0}", a2.NumberOfLegs );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Chapter08/Page223/Page223/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( string[] args )
6 | {
7 | int a, b, x = 14;
8 |
9 | a = x << 3; // Shift left
10 | b = x >> 3; // Shift right
11 |
12 | Console.WriteLine( "{0} << 3 = {1}", x, a );
13 | Console.WriteLine( "{0} >> 3 = {1}", x, b );
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Chapter13/Page339a/Page339a/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | public static int Add20( int x )
6 | {
7 | return x + 20;
8 | }
9 |
10 | delegate int OtherDel( int InParam );
11 | static void Main()
12 | {
13 | OtherDel del = Add20;
14 |
15 | Console.WriteLine( "{0}", del( 5 ) );
16 | Console.WriteLine( "{0}", del( 6 ) );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Chapter19/Page515/Page515/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | var numbers = new int[] { 2, 6, 4, 8, 10 };
9 |
10 | int howMany = ( from n in numbers
11 | where n < 7
12 | select n ).Count();
13 |
14 | Console.WriteLine( "Count: {0}", howMany );
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Chapter24/Page671/Page671/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | [Obsolete( "Use method SuperPrintOut" )] // Apply attribute to method.
6 | static void PrintOut( string str )
7 | {
8 | Console.WriteLine( str );
9 | }
10 |
11 | static void Main( string[] args )
12 | {
13 | PrintOut( "Start of Main" ); // Invoke obsolete method.
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Chapter25/Page695/Page695/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | string s1 = "25.873";
8 | string s2 = "36.240";
9 |
10 | double d1 = double.Parse( s1 );
11 | double d2 = double.Parse( s2 );
12 |
13 | double total = d1 + d2;
14 | Console.WriteLine( "Total: {0}", total );
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Chapter06/Page153/Page153/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Person
4 | {
5 | public string Name { get; private set; }
6 | public Person( string name )
7 | {
8 | Name = name;
9 | }
10 | }
11 |
12 | class Program
13 | {
14 | static public void Main()
15 | {
16 | Person p = new Person( "Capt. Ernest Evans" );
17 | Console.WriteLine( "Person's name is {0}", p.Name );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter16/Page410/Page410/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int i = 10; // Create and initialize value type
8 |
9 | object oi = i; // Create and initialize reference type
10 | Console.WriteLine( "i: {0}, io: {1}", i, oi );
11 |
12 | i = 12;
13 | oi = 15;
14 | Console.WriteLine( "i: {0}, io: {1}", i, oi );
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Chapter19/Page487/Page487/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Other
4 | {
5 | static public string Name = "Mary Jones";
6 | }
7 |
8 | class Program
9 | {
10 | static void Main()
11 | {
12 | string Major = "History";
13 |
14 | var student = new { Age = 19, Other.Name, Major };
15 |
16 | Console.WriteLine( "{0}, Age {1}, Major: {2}", student.Name, student.Age, student.Major );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Chapter20/WpfAwait/WpfAwait/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 WpfAwait
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter05/Page110/Page110/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | public void Count( int inVal )
6 | {
7 | if ( inVal == 0 )
8 | return;
9 | Count( inVal - 1 ); // Invoke this method again.
10 |
11 | Console.WriteLine( "{0}", inVal );
12 | }
13 |
14 | static void Main()
15 | {
16 | Program pr = new Program();
17 | pr.Count( 3 );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter15/Page366/Page366/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | var myInt = new[] { 20, 4, 16, 9, 2 }; // Create an array of ints.
8 |
9 | Array.Sort( myInt ); // Sort elements by magnitude.
10 |
11 | foreach ( var i in myInt ) // Print them out.
12 | Console.Write( "{0} ", i );
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/Chapter20/AsyncLambda/AsyncLambda/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 AsyncLambda
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter20/MessagePump/MessagePump/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 MessagePump
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter20/SimpleWorker/SimpleWorker/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 SimpleWorker
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter06/Page133/Page133/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class C1
4 | {
5 | public int MyValue // Allocates memory
6 | {
7 | set;
8 | get;
9 | }
10 | }
11 |
12 | class Program
13 | {
14 | static void Main()
15 | {
16 | C1 c = new C1();
17 | Console.WriteLine( "MyValue: {0}", c.MyValue );
18 |
19 | c.MyValue = 20;
20 | Console.WriteLine( "MyValue: {0}", c.MyValue );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter06/Page141/Page141/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public class Point
4 | {
5 | public int X = 1;
6 | public int Y = 2;
7 | }
8 |
9 | class Program
10 | {
11 | static void Main()
12 | {
13 | Point pt1 = new Point();
14 | Point pt2 = new Point { X = 5, Y = 6 };
15 |
16 | Console.WriteLine( "pt1: {0}, {1}", pt1.X, pt1.Y );
17 | Console.WriteLine( "pt2: {0}, {1}", pt2.X, pt2.Y );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter13/Page342a/Page342a/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | delegate void MyDel( int x );
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | MyDel mDel = delegate( int y )
10 | {
11 | int z = 10;
12 | Console.WriteLine( "{0}, {1}", y, z );
13 | };
14 |
15 | //Console.WriteLine( "{0}, {1}", y, z ); // Compile error.
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter22/Page634/Page634/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int x = 10;
8 | try
9 | {
10 | int y = 0;
11 | x /= y; // Raises an exception
12 | }
13 | catch
14 | {
15 | // ... Code to handle the exception
16 |
17 | Console.WriteLine( "Handling all exceptions - Keep on Running" );
18 | }
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/Chapter18/Page466/Page466/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | int[] MyArray = { 10, 11, 12, 13 }; // Create an array.
9 |
10 | IEnumerator ie = MyArray.GetEnumerator();
11 |
12 | while ( ie.MoveNext() )
13 | {
14 | int i = (int) ie.Current;
15 | Console.WriteLine( "{0}", i ); // Write it out.
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Chapter05/Page104/Page104/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Calc( int a, int b = 3 )
6 | {
7 | return a + b;
8 | }
9 |
10 | static void Main()
11 | {
12 | MyClass mc = new MyClass();
13 |
14 | int r0 = mc.Calc( 5, 6 ); // Use explicit values.
15 | int r1 = mc.Calc( 5 ); // Use default for b.
16 |
17 | Console.WriteLine( "{0}, {1}", r0, r1 );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter12/Page304/Page304/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | // Declare, create, and initialize an implicitly typed array.
8 | var arr = new int[,] { { 0, 1, 2 }, { 10, 11, 12 } };
9 |
10 | // Print the values.
11 | for ( int i=0; i < 2; i++ )
12 | for ( int j=0; j < 3; j++ )
13 | Console.WriteLine( "Element [{0},{1}] is {2}", i, j, arr[i, j] );
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Chapter17/Page454/Page454/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Animal { public int NumberOfLegs = 4; }
4 | class Dog : Animal { }
5 | class Program
6 | {
7 | delegate void Action1( T a );
8 |
9 | static void ActOnAnimal( Animal a )
10 | {
11 | Console.WriteLine( a.NumberOfLegs );
12 | }
13 |
14 | static void Main()
15 | {
16 | Action1 act1 = ActOnAnimal;
17 | Action1 dog1 = act1;
18 | dog1( new Dog() );
19 | }
20 | }
--------------------------------------------------------------------------------
/Chapter06/Page120/Page120/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class X
4 | {
5 | static public int A; // Static field
6 | static public void PrintValA() // Static method
7 | {
8 | Console.WriteLine( "Value of A: {0}", A );
9 | }
10 | }
11 |
12 | class Program
13 | {
14 | static void Main()
15 | {
16 | X.A = 10; // Use dot-syntax notation
17 | X.PrintValA(); // Use dot-syntax notation
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter20/AsyncLambda/AsyncLambda/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Chapter25/Page694/Page694/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | StringBuilder sb = new StringBuilder( "Hi there." );
9 | Console.WriteLine( "{0}", sb.ToString() ); // Print string.
10 |
11 | sb.Replace( "Hi", "Hello" ); // Replace a substring.
12 | Console.WriteLine( "{0}", sb.ToString() ); // Print changed string.
13 | }
14 | }
--------------------------------------------------------------------------------
/Chapter11/Page291/Page291/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | enum TrafficLight
4 | {
5 | Green,
6 | Yellow,
7 | Red
8 | }
9 |
10 | class Program
11 | {
12 | static void Main()
13 | {
14 | Console.WriteLine( "Second member of TrafficLight is {0}\n",
15 | Enum.GetName( typeof( TrafficLight ), 1 ) );
16 |
17 | foreach ( var name in Enum.GetNames( typeof( TrafficLight ) ) )
18 | Console.WriteLine( name );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter19/Page492/Page492/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | namespace Page492
5 | {
6 | class Program
7 | {
8 | static void Main( string[] args )
9 | {
10 | int[] arr1 = { 10, 11, 12, 13 };
11 |
12 | var query = from item in arr1
13 | where item < 13
14 | select item;
15 |
16 | foreach ( var item in query )
17 | Console.Write( "{0}, ", item );
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter25/Page699/Page699/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Page699
4 | {
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | int? myI1, myI2, myI3;
10 |
11 | myI1 = 28; // Value of underlying type
12 | myI2 = myI1; // Value of nullable type
13 | myI3 = null; // null
14 |
15 | Console.WriteLine( "myI1: {0}, myI2: {1}", myI1, myI2 );
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Chapter13/Page343/Page343/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | delegate void MyDel( );
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | MyDel mDel;
10 | {
11 | int x = 5;
12 | mDel = delegate
13 | {
14 | Console.WriteLine( "Value of x: {0}", x );
15 | };
16 | }
17 |
18 | // Console.WriteLine("Value of x: {0}", x);
19 |
20 | if ( null != mDel )
21 | mDel();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter05/Page075/Page075/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | void PrintDateAndTime() // Declare the method.
6 | {
7 | DateTime dt = DateTime.Now; // Get the current date and time.
8 | Console.WriteLine( "{0}", dt ); // Write it out.
9 | }
10 |
11 | static void Main() // Declare the method.
12 | {
13 | MyClass mc = new MyClass();
14 | mc.PrintDateAndTime(); // Invoke the method.
15 | }
16 | }
--------------------------------------------------------------------------------
/Chapter05/Page077/Page077/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int GetHour()
6 | {
7 | DateTime dt = DateTime.Now; // Get the current date and time.
8 | int hour = dt.Hour; // Get the hour.
9 |
10 | return hour; // Return an int.
11 | }
12 | }
13 |
14 | class Program
15 | {
16 | static void Main()
17 | {
18 | MyClass mc = new MyClass();
19 | Console.WriteLine( "Hour: {0}", mc.GetHour() );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Chapter22/Page640/Page640/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int inVal = 5;
8 |
9 | try
10 | {
11 | if ( inVal < 10 )
12 | {
13 | Console.Write( "First Branch - " );
14 | return;
15 | }
16 | else
17 | Console.Write( "Second Branch - " );
18 | }
19 | finally
20 | {
21 | Console.WriteLine( "In finally statement" );
22 | }
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/Chapter25/Page693/Page693/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | string s1 = "hi there! this, is: a string.";
8 |
9 | char[] delimiters = { ' ', '!', ',', ':', '.' };
10 |
11 | string[] words = s1.Split( delimiters, StringSplitOptions.RemoveEmptyEntries );
12 |
13 | Console.WriteLine( "Word Count: {0}\n\rThe Words...", words.Length );
14 |
15 | foreach ( string s in words )
16 | Console.WriteLine( " {0}", s );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Chapter22/Page638/Page638/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int x = 10;
8 | try
9 | {
10 | int y = 0;
11 | x /= y; // Raises an exception
12 | }
13 |
14 | catch ( DivideByZeroException e )
15 | {
16 | Console.WriteLine( "Message: {0}", e.Message );
17 | Console.WriteLine( "Source: {0}", e.Source );
18 | Console.WriteLine( "Stack: {0}", e.StackTrace );
19 | }
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/Chapter19/Page499/Page499/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | var groupA = new[] { 3, 4, 5, 6 };
9 | var groupB = new[] { 6, 7, 8, 9 };
10 |
11 | var someInts = from a in groupA
12 | from b in groupB
13 | where a > 4 && b <= 8
14 | select new { a, b, sum = a + b };
15 |
16 | foreach ( var a in someInts )
17 | Console.WriteLine( a );
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Chapter25/Page700/Page700/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 |
4 | class Program
5 | {
6 | static void Main( string[] args )
7 | {
8 | int? myI4 = null;
9 | Console.WriteLine( "myI4: {0}", myI4 ?? -1 );
10 |
11 | myI4 = 10;
12 | Console.WriteLine( "myI4: {0}", myI4 ?? -1 );
13 |
14 | int? i1 = null, i2 = null; // Both are null.
15 | if ( i1 == i2 ) // Operator returns true.
16 | Console.WriteLine( "Equal" );
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/Chapter06/Page132/Page132/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class RightTriangle
4 | {
5 | public double A = 3;
6 | public double B = 4;
7 | public double Hypotenuse // Read-only property
8 | {
9 | get { return Math.Sqrt( ( A * A ) + ( B * B ) ); } // Calculate return value
10 | }
11 | }
12 |
13 | class Program
14 | {
15 | static void Main()
16 | {
17 | RightTriangle c = new RightTriangle();
18 | Console.WriteLine( "Hypotenuse: {0}", c.Hypotenuse );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter08/Page213/Page213/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( string[] args )
6 | {
7 | Console.WriteLine( "0.0f % 1.5f is {0}", 0.0f % 1.5f );
8 | Console.WriteLine( "0.5f % 1.5f is {0}", 0.5f % 1.5f );
9 | Console.WriteLine( "1.0f % 1.5f is {0}", 1.0f % 1.5f );
10 | Console.WriteLine( "1.5f % 1.5f is {0}", 1.5f % 1.5f );
11 | Console.WriteLine( "2.0f % 1.5f is {0}", 2.0f % 1.5f );
12 | Console.WriteLine( "2.5f % 1.5f is {0}", 2.5f % 1.5f );
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/Chapter20/Page587/Page587/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks; // Must use this namespace
3 |
4 | namespace ExampleParallelFor
5 | {
6 | class Program
7 | {
8 | static void Main()
9 | {
10 | const int maxValues = 50;
11 | int[] squares = new int[maxValues];
12 |
13 | Parallel.For( 0, maxValues, i => squares[i] = i * i );
14 |
15 | for ( int i=0; i < maxValues; i++ )
16 | Console.WriteLine( "Element {0}: {1}", i, squares[i] );
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Chapter24/Page673/Page673/Program.cs:
--------------------------------------------------------------------------------
1 | #define DoTrace
2 |
3 | using System;
4 | using System.Diagnostics;
5 |
6 | namespace AttributesConditional
7 | {
8 | class Program
9 | {
10 | [Conditional( "DoTrace" )]
11 | static void TraceMessage( string str )
12 | {
13 | Console.WriteLine( str );
14 | }
15 |
16 | static void Main()
17 | {
18 | TraceMessage( "Start of Main" );
19 | Console.WriteLine( "Doing work in Main." );
20 | TraceMessage( "End of Main" );
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Chapter08/Page203/Page203/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | Console.WriteLine( "{0}", 1024 ); // int literal
8 | Console.WriteLine( "{0}", 3.1416 ); // double literal
9 | Console.WriteLine( "{0}", 3.1416F ); // float literal
10 | Console.WriteLine( "{0}", true ); // boolean literal
11 | Console.WriteLine( "{0}", 'x' ); // character literal
12 | Console.WriteLine( "{0}", "Hi there" ); // string literal
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/Chapter11/Page281/Page281/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | enum TrafficLight
4 | {
5 | Green,
6 | Yellow,
7 | Red
8 | }
9 |
10 | class Program
11 | {
12 | static void Main()
13 | {
14 | TrafficLight t1 = TrafficLight.Red; // Assign from member
15 | TrafficLight t2 = TrafficLight.Green; // Assign from member
16 | TrafficLight t3 = t2; // Assign from variable
17 |
18 | Console.WriteLine( t1 );
19 | Console.WriteLine( t2 );
20 | Console.WriteLine( t3 );
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/Chapter20/MessagePump/MessagePump/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Chapter11/Page280/Page280/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | enum TrafficLight
4 | {
5 | Green,
6 | Yellow,
7 | Red
8 | }
9 |
10 | class Program
11 | {
12 | static void Main( string[] args )
13 | {
14 | TrafficLight t1 = TrafficLight.Green;
15 | TrafficLight t2 = TrafficLight.Yellow;
16 | TrafficLight t3 = TrafficLight.Red;
17 |
18 | Console.WriteLine( "{0},\t{1}", t1, (int) t1 );
19 | Console.WriteLine( "{0},\t{1}", t2, (int) t2 );
20 | Console.WriteLine( "{0},\t{1}\n", t3, (int) t3 );
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/Chapter19/Page508/Page508/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | var groupA = new[] { 3, 4, 5, 6 };
9 | var groupB = new[] { 4, 5, 6, 7 };
10 |
11 | var someInts = from a in groupA
12 | join b in groupB on a equals b
13 | into groupAandB
14 | from c in groupAandB
15 | select c;
16 |
17 | foreach ( var a in someInts )
18 | Console.Write( "{0} ", a );
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/Chapter20/Page588/Page588/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace ParallelForeach1
5 | {
6 | class Program
7 | {
8 | static void Main()
9 | {
10 | string[] squares = new string[]
11 | { "We", "hold", "these", "truths", "to", "be", "self-evident",
12 | "that", "all", "men", "are", "created", "equal"};
13 |
14 | Parallel.ForEach( squares,
15 | i => Console.WriteLine( string.Format( "{0} has {1} letters", i, i.Length ) ) );
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Apress Source Code
2 |
3 | This repository accompanies [*Illustrated C# 2012*](http://www.apress.com/9781430242789) by Daniel Solis (Apress, 2012).
4 |
5 | 
6 |
7 | Download the files as a zip using the green button, or clone the repository to your machine using Git.
8 |
9 | ## Releases
10 |
11 | Release v1.0 corresponds to the code in the published book, without corrections or updates.
12 |
13 | ## Contributions
14 |
15 | See the file Contributing.md for more information on how you can contribute to this repository.
16 |
--------------------------------------------------------------------------------
/Chapter06/Page134/Page134/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Trivial
4 | {
5 | public static int MyValue { get; set; }
6 | public void PrintValue()
7 | {
8 | Console.WriteLine( "Value from inside: {0}", MyValue );
9 | }
10 | }
11 | class Program
12 | {
13 | static void Main()
14 | {
15 | Console.WriteLine( "Init Value: {0}", Trivial.MyValue );
16 |
17 | Trivial.MyValue = 10;
18 | Console.WriteLine( "New Value : {0}", Trivial.MyValue );
19 |
20 | Trivial tr = new Trivial();
21 | tr.PrintValue();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter06/Page144/Page144/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | int Var1 = 10;
6 |
7 | public int ReturnMaxSum( int Var1 )
8 | {
9 | return Var1 > this.Var1
10 | ? Var1 // Parameter
11 | : this.Var1; // Field
12 | }
13 | }
14 |
15 | class Program
16 | {
17 | static void Main()
18 | {
19 | MyClass mc = new MyClass();
20 |
21 | Console.WriteLine( "Max: {0}", mc.ReturnMaxSum( 30 ) );
22 | Console.WriteLine( "Max: {0}", mc.ReturnMaxSum( 5 ) );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter13/Page338/Page338/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | delegate void MyDel( ref int X );
4 | class MyClass
5 | {
6 | public void Add2( ref int x )
7 | {
8 | x += 2;
9 | }
10 |
11 | public void Add3( ref int x )
12 | {
13 | x += 3;
14 | }
15 |
16 | static void Main()
17 | {
18 | MyClass mc = new MyClass();
19 |
20 | MyDel mDel = mc.Add2;
21 | mDel += mc.Add3;
22 | mDel += mc.Add2;
23 |
24 | int x = 5;
25 | mDel( ref x );
26 |
27 | Console.WriteLine( "Value: {0}", x );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter15/Page378/Page378/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IIfc1
4 | {
5 | void PrintOut( string s );
6 | }
7 |
8 | interface IIfc2
9 | {
10 | void PrintOut( string t );
11 | }
12 |
13 | class MyClass : IIfc1, IIfc2 // Implement both interfaces.
14 | {
15 | public void PrintOut( string s ) // Single implementation for both
16 | {
17 | Console.WriteLine( "Calling through: {0}", s );
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main()
24 | {
25 | MyClass mc = new MyClass();
26 | mc.PrintOut( "object" );
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter16/Page398/Page398/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | // This code illustrates that running in the checked mode causes an exception.
6 | static void Main( string[] args )
7 | {
8 | ushort sh = 2000;
9 | byte sb;
10 |
11 | sb = unchecked( (byte) sh ); // Most significant bits lost
12 | Console.WriteLine( "sb: {0}", sb );
13 |
14 | sb = checked( (byte) sh ); // OverflowException raised
15 | Console.WriteLine( "sb: {0}", sb );
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/Chapter07/Page194/Page194/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | static public class MyMath
4 | {
5 | public static float PI = 3.14f;
6 |
7 | public static bool IsOdd( int x )
8 | {
9 | return x % 2 == 1;
10 | }
11 |
12 | public static int Times2( int x )
13 | {
14 | return 2 * x;
15 | }
16 | }
17 |
18 | class Program
19 | {
20 | static void Main()
21 | {
22 | int val = 3;
23 |
24 | Console.WriteLine( "{0} is odd is {1}.", val, MyMath.IsOdd( val ) );
25 | Console.WriteLine( "{0} * 2 = {1}.", val, MyMath.Times2( val ) );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter19/Page501/Page501/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | var groupA = new[] { 3, 4, 5, 6 };
9 | var groupB = new[] { 6, 7, 8, 9 };
10 | var someInts = from int a in groupA
11 | from int b in groupB
12 | let sum = a + b
13 | where sum >= 11
14 | where a == 4
15 | select new { a, b, sum };
16 | foreach ( var a in someInts )
17 | Console.WriteLine( a );
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Chapter19/Page532/Page532/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | XDocument xd = new XDocument(
9 | new XElement( "root",
10 | new XAttribute( "color", "red" ), // Attribute constructor
11 | new XAttribute( "size", "large" ), // Attribute constructor
12 | new XElement( "first" ),
13 | new XElement( "second" )
14 | )
15 | );
16 |
17 | Console.WriteLine( xd );
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Chapter12/Page299/Page299/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( )
6 | {
7 | int[] myIntArray; // Declare the array.
8 |
9 | myIntArray = new int[4]; // Instantiate the array.
10 |
11 | for ( int i=0; i < 4; i++ ) // Set the values.
12 | myIntArray[i] = i * 10;
13 |
14 | // Read and display the values of each element.
15 | for ( int i=0; i < 4; i++ )
16 | Console.WriteLine( "Value of element {0} = {1}", i, myIntArray[i] );
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/Chapter19/Page537/Page537/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Linq;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | XDocument xd = new XDocument(
8 | new XDeclaration( "1.0", "utf-8", "yes" ),
9 | new XComment( "This is a comment" ),
10 | new XProcessingInstruction( "xml-stylesheet",
11 | @"href=""stories.css"" type=""text/css""" ),
12 |
13 | new XElement( "root",
14 | new XElement( "first" ),
15 | new XElement( "second" )
16 | )
17 | );
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Chapter06/Page157/Page157/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | partial class MyClass
4 | {
5 | partial void PrintSum( int x, int y ); // Defining partial method
6 |
7 | public void Add( int x, int y )
8 | {
9 | PrintSum( x, y );
10 | }
11 | }
12 |
13 | partial class MyClass
14 | {
15 | partial void PrintSum( int x, int y ) // Implementing partial method
16 | {
17 | Console.WriteLine( "Sum is {0}", x + y );
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main()
24 | {
25 | var mc = new MyClass();
26 | mc.Add( 5, 6 );
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter08/Page217/Page217/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int x = 5, y;
8 | y = x++; // result: y: 5, x: 6
9 | Console.WriteLine( "y: {0}, x: {1}", y, x );
10 |
11 | x = 5;
12 | y = ++x; // result: y: 6, x: 6
13 | Console.WriteLine( "y: {0}, x: {1}", y, x );
14 |
15 | x = 5;
16 | y = x--; // result: y: 5, x: 4
17 | Console.WriteLine( "y: {0}, x: {1}", y, x );
18 |
19 | x = 5;
20 | y = --x; // result: y: 4, x: 4
21 | Console.WriteLine( "y: {0}, x: {1}", y, x );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter20/SimpleWorker/SimpleWorker/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Chapter16/Page417/Page417/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Employee : Person { }
4 | class Person
5 | {
6 | public string Name;
7 | public int Age;
8 |
9 | // Convert a Person object to an int.
10 | public static implicit operator int( Person p )
11 | {
12 | return p.Age;
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | Employee bill = new Employee();
21 | bill.Name = "William";
22 | bill.Age = 25;
23 |
24 | float fVar = bill;
25 | Console.WriteLine( "Person Info: {0}, {1}", bill.Name, fVar );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter20/Page601/Page601/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace Timers
5 | {
6 | class Program
7 | {
8 | int TimesCalled = 0;
9 |
10 | void Display( object state )
11 | {
12 | Console.WriteLine( "{0} {1}", (string) state, ++TimesCalled );
13 | }
14 |
15 | static void Main()
16 | {
17 | Program p = new Program();
18 |
19 | Timer myTimer = new Timer( p.Display, "Processing timer event", 2000, 1000 );
20 | Console.WriteLine( "Timer started." );
21 |
22 | Console.ReadLine();
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Chapter15/Page373/Page373/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IIfc1 // Declare interface.
4 | {
5 | void PrintOut( string s );
6 | }
7 |
8 | class MyClass : IIfc1 // Declare class.
9 | {
10 | public void PrintOut( string s ) // Implementation
11 | {
12 | Console.WriteLine( "Calling through: {0}", s );
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | MyClass mc = new MyClass(); // Create instance.
21 | mc.PrintOut( "object" ); // Call method.
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter05/Page094/Page094/Program.cs:
--------------------------------------------------------------------------------
1 |
2 | class MyClass
3 | {
4 | public int Val = 20; // Initialize field to 20.
5 | }
6 |
7 | class Program
8 | {
9 | static void MyMethod( out MyClass f1, out int f2 )
10 | {
11 | f1 = new MyClass(); // Create an object of the class.
12 | f1.Val = 25; // Assign to the class field.
13 | f2 = 15; // Assign to the int param.
14 | }
15 |
16 | static void Main()
17 | {
18 | MyClass a1 = null;
19 | int a2;
20 |
21 | MyMethod( out a1, out a2 ); // Call the method.
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter19/Page484/Page484/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | int[] numbers = { 2, 12, 5, 15 }; // Data source
10 | IEnumerable lowNums = // Define and store the query.
11 | from n in numbers
12 | where n < 10
13 | select n;
14 | foreach ( var x in lowNums ) // Execute the query.
15 | Console.Write( "{0}, ", x );
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/Chapter02/Page27/Page27/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | double myDouble = 12.345678;
8 | Console.WriteLine( "{0,-10:G} -- General", myDouble );
9 | Console.WriteLine( "{0,-10} -- Default, same as General", myDouble );
10 | Console.WriteLine( "{0,-10:F4} -- Fixed Point, 4 dec places", myDouble );
11 | Console.WriteLine( "{0,-10:C} -- Currency", myDouble );
12 | Console.WriteLine( "{0,-10:E3} -- Sci. Notation, 3 dec places", myDouble );
13 | Console.WriteLine( "{0,-10:x} -- Hexadecimal integer", 1194719 );
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Chapter19/Page500/Page500/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | namespace Page500
5 | {
6 | class Program
7 | {
8 | static void Main()
9 | {
10 | var groupA = new[] { 3, 4, 5, 6 };
11 | var groupB = new[] { 6, 7, 8, 9 };
12 |
13 | var someInts = from a in groupA
14 | from b in groupB
15 | let sum = a + b
16 | where sum == 12
17 | select new { a, b, sum };
18 |
19 | foreach ( var a in someInts )
20 | Console.WriteLine( a );
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter20/Page562/Page562/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | class Program
5 | {
6 | static void Main( string[] args )
7 | {
8 | Task t = BadAsync();
9 | t.Wait();
10 | Console.WriteLine( "Task Status : {0}", t.Status );
11 | Console.WriteLine( "Task IsFaulted: {0}", t.IsFaulted );
12 | }
13 |
14 | static async Task BadAsync()
15 | {
16 | try
17 | {
18 | await Task.Run( () => { throw new Exception(); } );
19 | }
20 | catch
21 | {
22 | Console.WriteLine( "Exception in BadAsync" );
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Chapter07/Page169/Page169/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyBaseClass
4 | {
5 | virtual public void Print()
6 | {
7 | Console.WriteLine( "This is the base class." );
8 | }
9 | }
10 |
11 | class MyDerivedClass : MyBaseClass
12 | {
13 | override public void Print()
14 | {
15 | Console.WriteLine( "This is the derived class." );
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | MyDerivedClass derived = new MyDerivedClass();
24 | MyBaseClass mybc = (MyBaseClass) derived;
25 |
26 | derived.Print();
27 | mybc.Print();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter20/Page559/Page559/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | static class MyClass
5 | {
6 | private static int GetSum( int i1, int i2 )
7 | {
8 | return i1 + i2;
9 | }
10 |
11 | public static async Task DoWorkAsync()
12 | {
13 | int value = await Task.Run( () => GetSum( 5, 6 ) );
14 | Console.WriteLine( value.ToString() );
15 | }
16 | }
17 |
18 | class Program
19 | {
20 | static void Main()
21 | {
22 | Task t = MyClass.DoWorkAsync();
23 | t.Wait();
24 | Console.WriteLine( "Press Enter key to exit" );
25 | Console.Read();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter17/Page447/Page447/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IMyIfc // Generic interface
4 | {
5 | T ReturnIt( T inValue );
6 | }
7 |
8 | class Simple : IMyIfc // Generic class
9 | {
10 | public S ReturnIt( S inValue ) // Implement generic interface.
11 | {
12 | return inValue;
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | var trivInt = new Simple();
21 | var trivString = new Simple();
22 |
23 | Console.WriteLine( "{0}", trivInt.ReturnIt( 5 ) );
24 | Console.WriteLine( "{0}", trivString.ReturnIt( "Hi there." ) );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter05/Page079/Page079/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | void TimeUpdate()
6 | {
7 | DateTime dt = DateTime.Now; // Get the current date and time.
8 | if ( dt.Hour < 12 ) // If the hour is less than 12,
9 | return; // then return.
10 |
11 | Console.WriteLine( "It's afternoon!" ); // Otherwise, print message.
12 | }
13 |
14 | static void Main()
15 | {
16 | MyClass mc = new MyClass(); // Create an instance of the class.
17 | mc.TimeUpdate(); // Invoke the method.
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter08/Page221/Page221/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main( string[] args )
6 | {
7 | const byte x = 12, y = 10;
8 | Console.WriteLine( "x = {0}, y = {1}\n", x, y );
9 |
10 | sbyte a;
11 | a = x & y; // a = 8
12 | Console.WriteLine( "a = {0}", a );
13 |
14 | a = x | y; // a = 14
15 | Console.WriteLine( "a = {0}", a );
16 |
17 | a = x ^ y; // a = 6
18 | Console.WriteLine( "a = {0}", a );
19 |
20 | a = ~x; // a = -13
21 | Console.WriteLine( "a = {0}", a );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter10/Page270/Page270/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | struct Point
4 | {
5 | public int X;
6 | public int Y;
7 | }
8 |
9 | class Program
10 | {
11 | static void Main()
12 | {
13 | Point first, second, third;
14 |
15 | first.X = 10;
16 | first.Y = 10;
17 | second.X = 20;
18 | second.Y = 20;
19 |
20 | third.X = first.X + second.X;
21 | third.Y = first.Y + second.Y;
22 |
23 | Console.WriteLine( "first: {0}, {1}", first.X, first.Y );
24 | Console.WriteLine( "second: {0}, {1}", second.X, second.Y );
25 | Console.WriteLine( "third: {0}, {1}", third.X, third.Y );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter17/Page446/Page446/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public delegate TR Func( T1 p1, T2 p2 ); // Generic delegate
4 |
5 | class Simple
6 | {
7 | static public string PrintString( int p1, int p2 ) // Method matches delegate
8 | {
9 | int total = p1 + p2;
10 | return total.ToString();
11 | }
12 | }
13 |
14 | class Program
15 | {
16 | static void Main()
17 | {
18 | var myDel = new Func( Simple.PrintString ); // Create inst of delegate.
19 |
20 | Console.WriteLine( "Total: {0}", myDel( 15, 13 ) ); // Call delegate.
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter05/Page106/Page106/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Calc( int a = 2, int b = 3, int c = 4 )
6 | {
7 | return ( a + b ) * c;
8 | }
9 |
10 | static void Main()
11 | {
12 | MyClass mc = new MyClass();
13 |
14 | int r0 = mc.Calc( 5, 6, 7 ); // Use all explicit values.
15 | int r1 = mc.Calc( 5, 6 ); // Use default for c.
16 | int r2 = mc.Calc( 5 ); // Use default for b and c.
17 | int r3 = mc.Calc(); // Use all defaults.
18 |
19 | Console.WriteLine( "{0}, {1}, {2}, {3}", r0, r1, r2, r3 );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Chapter06/Page128/Page128/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class C1
4 | {
5 | private int TheRealValue = 10; // Backing Field: memory allocated
6 |
7 | public int MyValue // Property: no memory allocated
8 | {
9 | set { TheRealValue = value; } // Sets the value of field TheRealValue
10 | get { return TheRealValue; } // Gets the value of the field
11 | }
12 | }
13 | class Program
14 | {
15 | static void Main()
16 | {
17 | C1 c = new C1();
18 | Console.WriteLine( "MyValue: {0}", c.MyValue );
19 |
20 | c.MyValue = 20;
21 | Console.WriteLine( "MyValue: {0}", c.MyValue );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter17/Page443/Page443/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | struct PieceOfData // Generic struct
4 | {
5 | public PieceOfData( T value )
6 | {
7 | _data = value;
8 | }
9 |
10 | private T _data;
11 |
12 | public T Data
13 | {
14 | get { return _data; }
15 | set { _data = value; }
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | var intData = new PieceOfData( 10 );
24 | var stringData = new PieceOfData( "Hi there." );
25 |
26 | Console.WriteLine( "intData = {0}", intData.Data );
27 | Console.WriteLine( "stringData = {0}", stringData.Data );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter18/Page474/Page474/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | class MyClass
5 | {
6 | public IEnumerator GetEnumerator()
7 | {
8 | return BlackAndWhite(); // Returns the enumerator
9 | }
10 |
11 | public IEnumerator BlackAndWhite() // Iterator
12 | {
13 | yield return "black";
14 | yield return "gray";
15 | yield return "white";
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | MyClass mc = new MyClass();
24 |
25 | foreach ( string shade in mc )
26 | Console.WriteLine( shade );
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter07/Page173/Page173/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyBaseClass
4 | {
5 | private int _myInt = 5;
6 | virtual public int MyProperty
7 | {
8 | get { return _myInt; }
9 | }
10 | }
11 |
12 | class MyDerivedClass : MyBaseClass
13 | {
14 | private int _myInt = 10;
15 | override public int MyProperty
16 | {
17 | get { return _myInt; }
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main()
24 | {
25 | MyDerivedClass derived = new MyDerivedClass();
26 | MyBaseClass mybc = (MyBaseClass) derived;
27 |
28 | Console.WriteLine( derived.MyProperty );
29 | Console.WriteLine( mybc.MyProperty );
30 | }
31 | }
--------------------------------------------------------------------------------
/Chapter04/Page064/Page064/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class DaysTemp // Declare class DaysTemp
4 | {
5 | public int High = 75;
6 | public int Low = 45;
7 | }
8 |
9 | class Program // Declare class Program
10 | {
11 | static void Main()
12 | {
13 | DaysTemp temp = new DaysTemp(); // Create the object
14 |
15 | temp.High = 85; // Assign to the fields
16 | temp.Low = 60;
17 |
18 | Console.WriteLine( "High: {0}", temp.High ); // Read from fields
19 | Console.WriteLine( "Low: {0}", temp.Low );
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/Chapter15/Page375/Page375/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IIfc1
4 | {
5 | void PrintOut( string s );
6 | }
7 |
8 | class MyClass : IIfc1
9 | {
10 | public void PrintOut( string s )
11 | {
12 | Console.WriteLine( "Calling through: {0}", s );
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | MyClass mc = new MyClass(); // Create class object.
21 | mc.PrintOut( "object" ); // Call class object implementation method.
22 |
23 | IIfc1 ifc = (IIfc1) mc; // Cast class object ref to interface ref.
24 | ifc.PrintOut( "interface" ); // Call interface method.
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter05/Page089/Page089/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Val = 20;
6 | }
7 |
8 | class Program
9 | {
10 | static void RefAsParameter( MyClass f1 )
11 | {
12 | f1.Val = 50;
13 | Console.WriteLine( "After member assignment: {0}", f1.Val );
14 |
15 | f1 = new MyClass();
16 | Console.WriteLine( "After new object creation: {0}", f1.Val );
17 | }
18 |
19 | static void Main()
20 | {
21 | MyClass a1 = new MyClass();
22 |
23 | Console.WriteLine( "Before method call: {0}", a1.Val );
24 | RefAsParameter( a1 );
25 | Console.WriteLine( "After method call: {0}", a1.Val );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter20/Page556/Page556/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | class MyClass
5 | {
6 | public int Get10() // Func compatible
7 | {
8 | return 10;
9 | }
10 | public async Task DoWorkAsync()
11 | {
12 | Func ten = new Func( Get10 );
13 | int a = await Task.Run( ten );
14 |
15 | int b = await Task.Run( new Func( Get10 ) );
16 |
17 | int c = await Task.Run( () => { return 10; } );
18 |
19 | Console.WriteLine( "{0} {1} {2}", a, b, c );
20 | }
21 | }
22 |
23 | class Program
24 | {
25 | static void Main()
26 | {
27 | Task t = ( new MyClass() ).DoWorkAsync();
28 | t.Wait();
29 | }
30 | }
--------------------------------------------------------------------------------
/Chapter12/Page315/Page315/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int total = 0;
8 | int[][] arr1 = new int[2][];
9 | arr1[0] = new int[] { 10, 11 };
10 | arr1[1] = new int[] { 12, 13, 14 };
11 |
12 | foreach ( int[] array in arr1 ) // Process the top level.
13 | {
14 | Console.WriteLine( "Starting new array" );
15 | foreach ( int item in array ) // Process the second level.
16 | {
17 | total += item;
18 | Console.WriteLine( " Item: {0}, Current Total: {1}", item, total );
19 | }
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Chapter19/Page534/Page534/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | XDocument xd = new XDocument(
9 | new XElement( "root",
10 | new XAttribute( "color", "red" ),
11 | new XAttribute( "size", "large" ),
12 | new XElement( "first" )
13 | )
14 | );
15 |
16 | XElement rt = xd.Element( "root" ); // Get the element.
17 |
18 | rt.Attribute( "color" ).Remove(); // Remove the color attribute.
19 | rt.SetAttributeValue( "size", null ); // Remove the size attribute.
20 |
21 | Console.WriteLine( xd );
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Chapter19/Page518/Page518/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static bool IsOdd( int x ) // Method to be used by the delegate object
7 | {
8 | return x % 2 == 1; // Return true if x is odd.
9 | }
10 |
11 | static void Main()
12 | {
13 | int[] intArray = new int[] { 3, 4, 5, 6, 7, 9 };
14 |
15 | Func myDel = new Func( IsOdd ); // Delegate object
16 | var countOdd = intArray.Count( myDel ); // Use delegate.
17 |
18 | Console.WriteLine( "Count of odd numbers: {0}", countOdd );
19 | }
20 | }
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Chapter22/Page647/Page647/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public static void PrintArg( string arg )
6 | {
7 | try
8 | {
9 | if ( arg == null )
10 | {
11 | ArgumentNullException myEx = new ArgumentNullException( "arg" );
12 | throw myEx;
13 | }
14 | Console.WriteLine( arg );
15 | }
16 | catch ( ArgumentNullException e )
17 | {
18 | Console.WriteLine( "Message: {0}", e.Message );
19 | }
20 | }
21 | }
22 |
23 | class Program
24 | {
25 | static void Main()
26 | {
27 | string s = null;
28 | MyClass.PrintArg( s );
29 | MyClass.PrintArg( "Hi there!" );
30 | }
31 | }
--------------------------------------------------------------------------------
/Chapter07/Page167/Page167/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyBaseClass
4 | {
5 | public void Print()
6 | {
7 | Console.WriteLine( "This is the base class." );
8 | }
9 | }
10 |
11 | class MyDerivedClass : MyBaseClass
12 | {
13 | new public void Print()
14 | {
15 | Console.WriteLine( "This is the derived class." );
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | MyDerivedClass derived = new MyDerivedClass();
24 | MyBaseClass mybc = (MyBaseClass) derived;
25 |
26 | derived.Print(); // Call Print from derived portion.
27 | mybc.Print(); // Call Print from base portion.
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter05/Page084/Page084/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Val = 20; // Initialize the field to 20.
6 | }
7 |
8 | class Program
9 | {
10 | static void MyMethod( MyClass f1, int f2 )
11 | {
12 | f1.Val = f1.Val + 5; // Add 5 to field of f1 param.
13 | f2 = f2 + 5; // Add 5 to second param.
14 | Console.WriteLine( "f1.Val: {0}, f2: {1}", f1.Val, f2 );
15 | }
16 | static void Main()
17 | {
18 | MyClass a1 = new MyClass();
19 | int a2 = 10;
20 |
21 | MyMethod( a1, a2 ); // Call the method.
22 | Console.WriteLine( "f1.Val: {0}, f2: {1}", a1.Val, a2 );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter05/Page087/Page087/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Val = 20; // Initialize field to 20.
6 | }
7 |
8 | class Program
9 | {
10 | static void MyMethod( ref MyClass f1, ref int f2 )
11 | {
12 | f1.Val = f1.Val + 5; // Add 5 to field of f1 param.
13 | f2 = f2 + 5; // Add 5 to second param.
14 | Console.WriteLine( "f1.Val: {0}, f2: {1}", f1.Val, f2 );
15 | }
16 |
17 | static void Main()
18 | {
19 | MyClass a1 = new MyClass();
20 | int a2 = 10;
21 |
22 | MyMethod( ref a1, ref a2 ); // Call the method.
23 | Console.WriteLine( "f1.Val: {0}, f2: {1}", a1.Val, a2 );
24 | }
25 | }
--------------------------------------------------------------------------------
/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing to Apress Source Code
2 |
3 | Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers.
4 |
5 | ## How to Contribute
6 |
7 | 1. Make sure you have a GitHub account.
8 | 2. Fork the repository for the relevant book.
9 | 3. Create a new branch on which to make your change, e.g.
10 | `git checkout -b my_code_contribution`
11 | 4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted.
12 | 5. Submit a pull request.
13 |
14 | Thank you for your contribution!
--------------------------------------------------------------------------------
/Chapter19/Page514/Page514/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | int[] intArray = new int[] { 3, 4, 5, 6, 7, 9 };
9 |
10 | var count1 = Enumerable.Count( intArray ); // Method syntax
11 | var firstNum1 = Enumerable.First( intArray ); // Method syntax
12 |
13 | var count2 = intArray.Count(); // Extension syntax
14 | var firstNum2 = intArray.First(); // Extension syntax
15 |
16 | Console.WriteLine( "Count: {0}, FirstNumber: {1}", count1, firstNum1 );
17 | Console.WriteLine( "Count: {0}, FirstNumber: {1}", count2, firstNum2 );
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Chapter13/Page345/Page345/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | delegate double MyDel( int par );
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | MyDel del = delegate( int x ) { return x + 1; }; // Anonymous method
10 |
11 | MyDel le1 = ( int x ) => { return x + 1; }; // Lambda expression
12 | MyDel le2 = ( x ) => { return x + 1; };
13 | MyDel le3 = x => { return x + 1; };
14 | MyDel le4 = x => x + 1;
15 |
16 | Console.WriteLine( "{0}", del( 12 ) );
17 | Console.WriteLine( "{0}", le1( 12 ) );
18 | Console.WriteLine( "{0}", le2( 12 ) );
19 | Console.WriteLine( "{0}", le3( 12 ) );
20 | Console.WriteLine( "{0}", le4( 12 ) );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter19/Page505/Page505/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | var students = new[] // Array of objects of an anonymous type
9 | {
10 | new { LName="Jones", FName="Mary", Age=19, Major="History" },
11 | new { LName="Smith", FName="Bob", Age=20, Major="CompSci" },
12 | new { LName="Fleming", FName="Carol", Age=21, Major="History" }
13 | };
14 |
15 | var query = from s in students
16 | select new { s.LName, s.FName, s.Major };
17 |
18 | foreach ( var q in query )
19 | Console.WriteLine( "{0} {1} -- {2}",
20 | q.FName, q.LName, q.Major );
21 | }
22 | }
--------------------------------------------------------------------------------
/Chapter09/Page255/Page255/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | for ( int x=1; x < 6; x++ )
8 | {
9 | switch ( x )
10 | {
11 | case 5:
12 | Console.WriteLine( "x is {0} -- In Case 5", x );
13 | break;
14 | }
15 | }
16 |
17 | Console.WriteLine();
18 |
19 | ////////////////////////////////////////////////////////////////////
20 | for ( int x=1; x < 4; x++ )
21 | {
22 | switch ( x )
23 | {
24 | default:
25 | Console.WriteLine( "x is {0} -- In Default case", x );
26 | break;
27 | }
28 | }
29 | }
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/Chapter13/Page337/Page337/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | delegate int MyDel(); // Declare delegate with return value.
4 |
5 | class MyClass
6 | {
7 | int IntValue = 5;
8 |
9 | public int Add2()
10 | {
11 | IntValue += 2; return IntValue;
12 | }
13 |
14 | public int Add3()
15 | {
16 | IntValue += 3; return IntValue;
17 | }
18 | }
19 |
20 | class Program
21 | {
22 | static void Main()
23 | {
24 | MyClass mc = new MyClass();
25 |
26 | MyDel mDel = mc.Add2; // Create and initialize the delegate.
27 | mDel += mc.Add3; // Add a method.
28 | mDel += mc.Add2; // Add a method.
29 |
30 | Console.WriteLine( "Value: {0}", mDel() );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Chapter09/Page264/Page264/Program.cs:
--------------------------------------------------------------------------------
1 | using System; // using DIRECTIVE; not using statement
2 | using System.IO; // using DIRECTIVE; not using statement
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | // using statement
9 | using ( TextWriter tw = File.CreateText( "Lincoln.txt" ) )
10 | {
11 | tw.WriteLine( "Four score and seven years ago, ..." );
12 | }
13 |
14 | // using statement
15 | using ( TextReader tr = File.OpenText( "Lincoln.txt" ) )
16 | {
17 | string InputString;
18 | while ( null != ( InputString = tr.ReadLine() ) )
19 | Console.WriteLine( InputString );
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter20/Page563/Page563/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Threading.Tasks;
4 |
5 | static class MyDownloadString
6 | {
7 | public static void DoRun()
8 | {
9 | Task t = CountCharactersAsync( "http://www.illustratedcsharp.com" );
10 |
11 | t.Wait();
12 | Console.WriteLine( "The task has finished, returning value {0}.", t.Result );
13 | }
14 |
15 | private static async Task CountCharactersAsync( string site )
16 | {
17 | string result = await new WebClient().DownloadStringTaskAsync( new Uri( site ) );
18 | return result.Length;
19 | }
20 | }
21 |
22 | class Program
23 | {
24 | static void Main()
25 | {
26 | MyDownloadString.DoRun();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter07/Page165/Page165/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class SomeClass // Base class
4 | {
5 | public string Field1 = "Field1 -- In the base class";
6 | }
7 |
8 | class OtherClass : SomeClass // Derived class
9 | {
10 | new public string Field1 = "Field1 -- In the derived class";
11 |
12 | public void PrintField1()
13 | {
14 | Console.WriteLine( Field1 ); // Access the derived class.
15 | Console.WriteLine( base.Field1 ); // Access the base class.
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | OtherClass oc = new OtherClass();
24 | oc.PrintField1();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter15/Page377/Page377/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IDataRetrieve { int GetData(); } // Declare interface.
4 | interface IDataStore { void SetData( int x ); } // Declare interface.
5 |
6 | class MyData : IDataRetrieve, IDataStore // Declare class.
7 | {
8 | int Mem1; // Declare field.
9 |
10 | public int GetData()
11 | {
12 | return Mem1;
13 | }
14 |
15 | public void SetData( int x )
16 | {
17 | Mem1 = x;
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main() // Main
24 | {
25 | MyData data = new MyData();
26 | data.SetData( 5 );
27 | Console.WriteLine( "Value = {0}", data.GetData() );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter24/Page674/Page674/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 |
4 | public static class Program
5 | {
6 | public static void MyTrace( string message,
7 | [CallerFilePath] string fileName = "",
8 | [CallerLineNumber] int lineNumber = 0,
9 | [CallerMemberName] string callingMember = "" )
10 | {
11 | Console.WriteLine( "File: {0}", fileName );
12 | Console.WriteLine( "Line: {0}", lineNumber );
13 | Console.WriteLine( "Called From: {0}", callingMember );
14 | Console.WriteLine( "Message: {0}", message );
15 | }
16 |
17 | public static void Main()
18 | {
19 | MyTrace( "Simple message" );
20 | }
21 | }
--------------------------------------------------------------------------------
/Chapter20/WpfAwait/WpfAwait/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
8 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Chapter05/Page108/Page108/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void MethodA( int par1, int par2 )
6 | {
7 | Console.WriteLine( "Enter MethodA: {0}, {1}", par1, par2 );
8 | MethodB( 11, 18 ); // Call MethodB.
9 | Console.WriteLine( "Exit MethodA" );
10 | }
11 |
12 | static void MethodB( int par1, int par2 )
13 | {
14 | Console.WriteLine( "Enter MethodB: {0}, {1}", par1, par2 );
15 | Console.WriteLine( "Exit MethodB" );
16 | }
17 |
18 | static void Main()
19 | {
20 | Console.WriteLine( "Enter Main" );
21 | MethodA( 15, 30 ); // Call MethodA.
22 | Console.WriteLine( "Exit Main" );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter20/Page558/Page558/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | static class MyClass
5 | {
6 | public static async Task DoWorkAsync()
7 | {
8 | await Task.Run( () => Console.WriteLine( 5.ToString() ) );
9 |
10 | Console.WriteLine( ( await Task.Run( () => 6 ) ).ToString() );
11 |
12 | await Task.Run( () => Task.Run( () => Console.WriteLine( 7.ToString() ) ) );
13 |
14 | int value = await Task.Run( () => Task.Run( () => 8 ) );
15 | Console.WriteLine( value.ToString() );
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | Task t = MyClass.DoWorkAsync();
24 | t.Wait();
25 | Console.WriteLine( "Press Enter key to exit" );
26 | Console.Read();
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter06/Page139/Page139/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class RandomNumberClass
4 | {
5 | private static Random RandomKey; // Private static field
6 |
7 | static RandomNumberClass() // Static constructor
8 | {
9 | RandomKey = new Random(); // Initialize RandomKey
10 | }
11 |
12 | public int GetRandomNumber()
13 | {
14 | return RandomKey.Next();
15 | }
16 | }
17 |
18 | class Program
19 | {
20 | static void Main()
21 | {
22 | RandomNumberClass a = new RandomNumberClass();
23 | RandomNumberClass b = new RandomNumberClass();
24 |
25 | Console.WriteLine( "Next Random #: {0}", a.GetRandomNumber() );
26 | Console.WriteLine( "Next Random #: {0}", b.GetRandomNumber() );
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter12/Page313/Page313/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int MyField = 0;
6 | }
7 |
8 | class Program
9 | {
10 | static void Main()
11 | {
12 | MyClass[] mcArray = new MyClass[4]; // Create array.
13 |
14 | for ( int i = 0; i < 4; i++ )
15 | {
16 | mcArray[i] = new MyClass(); // Create class objects.
17 | mcArray[i].MyField = i; // Set field.
18 | }
19 |
20 | foreach ( MyClass item in mcArray )
21 | item.MyField += 10; // Change the data.
22 |
23 | foreach ( MyClass item in mcArray )
24 | Console.WriteLine( "{0}", item.MyField ); // Read the changed data.
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter05/Page103/Page103/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Calc( int a, int b, int c )
6 | {
7 | return ( a + b ) * c;
8 | }
9 |
10 | static void Main()
11 | {
12 | MyClass mc = new MyClass();
13 | int r0 = mc.Calc( 4, 3, 2 ); // Positional Parameters
14 | int r1 = mc.Calc( 4, b: 3, c: 2 ); // Positional and Named Parameters
15 | int r2 = mc.Calc( 4, c: 2, b: 3 ); // Switch order
16 | int r3 = mc.Calc( c: 2, b: 3, a: 4 ); // All named parameters
17 | int r4 = mc.Calc( c: 2, b: 1 + 2, a: 3 + 1 ); // Named parameter expressions
18 |
19 | Console.WriteLine( "{0}, {1}, {2}, {3}, {4}", r0, r1, r2, r3, r4 );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Chapter12/Page318/Page318/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | public static void PrintArray( int[] a )
6 | {
7 | foreach ( var x in a )
8 | Console.Write( "{0} ", x );
9 | Console.WriteLine( "" );
10 | }
11 |
12 | static void Main()
13 | {
14 | int[] arr = new int[] { 15, 20, 5, 25, 10 };
15 | PrintArray( arr );
16 |
17 | Array.Sort( arr );
18 | PrintArray( arr );
19 |
20 | Array.Reverse( arr );
21 | PrintArray( arr );
22 |
23 | Console.WriteLine();
24 | Console.WriteLine( "Rank = {0}, Length = {1}", arr.Rank, arr.Length );
25 | Console.WriteLine( "GetLength(0) = {0}", arr.GetLength( 0 ) );
26 | Console.WriteLine( "GetType() = {0}", arr.GetType() );
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter17/Page448/Page448/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IMyIfc // Generic interface
4 | {
5 | T ReturnIt( T inValue );
6 | }
7 |
8 | class Simple : IMyIfc, IMyIfc // Nongeneric class
9 | {
10 | public int ReturnIt( int inValue ) // Implement interface using int.
11 | {
12 | return inValue;
13 | }
14 |
15 | public string ReturnIt( string inValue ) // Implement interface using string.
16 | {
17 | return inValue;
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main()
24 | {
25 | Simple trivial = new Simple();
26 | Console.WriteLine( "{0}", trivial.ReturnIt( 5 ) );
27 | Console.WriteLine( "{0}", trivial.ReturnIt( "Hi there." ) );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter19/Page540/Page540/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Xml.Linq;
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | XDocument xd = XDocument.Load( "SimpleSample.xml" ); // Load the document.
10 | XElement rt = xd.Element( "MyElements" ); // Get the root element.
11 |
12 | var xyz = from e in rt.Elements()
13 | select new { e.Name, color = e.Attribute( "color" ) };
14 |
15 | foreach ( var x in xyz )
16 | Console.WriteLine( x ); // Default formatting
17 | Console.WriteLine();
18 |
19 | foreach ( var x in xyz )
20 | Console.WriteLine( "{0,-6}, color: {1, -7}", x.Name, x.color.Value );
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/Chapter08/Page236/Page236/Program.cs:
--------------------------------------------------------------------------------
1 | using System; // Use the Reflection namespace to take full advantage of determining information about a type.
2 | using System.Reflection;
3 |
4 | class SomeClass
5 | {
6 | public int Field1;
7 | public int Field2;
8 | public void Method1() { }
9 | public int Method2() { return 1; }
10 | }
11 |
12 | class Program
13 | {
14 | static void Main()
15 | {
16 | Type t = typeof( SomeClass );
17 |
18 | FieldInfo[] fi = t.GetFields();
19 | MethodInfo[] mi = t.GetMethods();
20 |
21 | foreach ( FieldInfo f in fi )
22 | Console.WriteLine( "Field : {0}", f.Name );
23 |
24 | foreach ( MethodInfo m in mi )
25 | Console.WriteLine( "Method: {0}", m.Name );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter10/Page272/Page272/Program.cs:
--------------------------------------------------------------------------------
1 | class CSimple
2 | {
3 | public int X;
4 | public int Y;
5 | }
6 |
7 | struct Simple
8 | {
9 | public int X;
10 | public int Y;
11 | }
12 |
13 | class Program
14 | {
15 | static void Main()
16 | {
17 | CSimple cs1 = new CSimple(), cs2 = null; // Class instances
18 | Simple ss1 = new Simple(), ss2 = new Simple(); // Struct instances
19 |
20 | cs1.X = ss1.X = 5; // Assign 5 to ss1.X and cs1.X.
21 | cs1.Y = ss1.Y = 10; // Assign 10 to ss1.Y and cs1.Y.
22 |
23 | cs2 = cs1; // Assign class instance.
24 | ss2 = ss1; // Assign struct instance.
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter07/Page196/Page196/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | static class ExtendMyData
4 | {
5 | public static double Average( MyData md )
6 | {
7 | return md.Sum() / 3;
8 | }
9 | }
10 |
11 | class MyData
12 | {
13 | private double D1; // Fields
14 | private double D2;
15 | private double D3;
16 |
17 | public MyData( double d1, double d2, double d3 ) // Constructor
18 | {
19 | D1 = d1;
20 | D2 = d2;
21 | D3 = d3;
22 | }
23 |
24 | public double Sum() // Method Sum
25 | {
26 | return D1 + D2 + D3;
27 | }
28 | }
29 |
30 | class Program
31 | {
32 | static void Main()
33 | {
34 | MyData md = new MyData( 3, 4, 5 );
35 | Console.WriteLine( "Average: {0}", ExtendMyData.Average( md ) );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Chapter14/Page360/Page360/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Publisher
4 | {
5 | public event EventHandler SimpleEvent;
6 | public void RaiseTheEvent() { SimpleEvent( this, null ); }
7 | }
8 |
9 | class Subscriber
10 | {
11 | public void MethodA( object o, EventArgs e ) { Console.WriteLine( "AAA" ); }
12 | public void MethodB( object o, EventArgs e ) { Console.WriteLine( "BBB" ); }
13 | }
14 |
15 | class Program
16 | {
17 | static void Main()
18 | {
19 | Publisher p = new Publisher();
20 | Subscriber s = new Subscriber();
21 |
22 | p.SimpleEvent += s.MethodA;
23 | p.SimpleEvent += s.MethodB;
24 | p.RaiseTheEvent();
25 |
26 | Console.WriteLine( "\r\nRemove MethodB" );
27 | p.SimpleEvent -= s.MethodB;
28 | p.RaiseTheEvent();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Chapter20/Page569/Page569/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading.Tasks;
4 |
5 | class Simple
6 | {
7 | Stopwatch sw = new Stopwatch();
8 |
9 | public void DoRun()
10 | {
11 | Console.WriteLine( "Caller: Before call" );
12 | ShowDelayAsync();
13 | Console.WriteLine( "Caller: After call" );
14 | }
15 |
16 | private async void ShowDelayAsync()
17 | {
18 | sw.Start();
19 | Console.WriteLine( " Before Delay: {0}", sw.ElapsedMilliseconds );
20 | await Task.Delay( 1000 );
21 | Console.WriteLine( " After Delay : {0}", sw.ElapsedMilliseconds );
22 | }
23 | }
24 |
25 | class Program
26 | {
27 | static void Main()
28 | {
29 | Simple ds = new Simple();
30 | ds.DoRun();
31 | Console.Read();
32 | }
33 | }
--------------------------------------------------------------------------------
/Chapter11/Page287/Page287/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | // Uncomment the following line for the second run of the program and notice the difference in the output.
4 | //[Flags]
5 | enum CardDeckSettings : uint
6 | {
7 | SingleDeck = 0x01, // bit 0
8 | LargePictures = 0x02, // bit 1
9 | FancyNumbers = 0x04, // bit 2
10 | Animation = 0x08 // bit 3
11 | }
12 | class Program
13 | {
14 | static void Main()
15 | {
16 | CardDeckSettings ops;
17 |
18 | // Set one flag.
19 | ops = CardDeckSettings.FancyNumbers;
20 | Console.WriteLine( ops.ToString() );
21 |
22 | // Set two bit flags.
23 | ops = CardDeckSettings.FancyNumbers | CardDeckSettings.Animation;
24 | Console.WriteLine( ops.ToString() ); // Print what?
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter19/Page535/Page535/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq;
3 |
4 | namespace Page535
5 | {
6 | class Program
7 | {
8 | static void Main()
9 | {
10 | XDocument xd = new XDocument(
11 | new XElement( "root",
12 | new XAttribute( "color", "red" ),
13 | new XAttribute( "size", "large" ),
14 | new XElement( "first" )
15 | )
16 | );
17 |
18 | XElement rt = xd.Element( "root" ); // Get the element.
19 |
20 | rt.SetAttributeValue( "size", "medium" ); // Change attribute value.
21 | rt.SetAttributeValue( "width", "narrow" ); // Add an attribute.
22 |
23 | Console.WriteLine( xd );
24 | Console.WriteLine();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter05/Page091/Page091/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Val = 20;
6 | }
7 |
8 | class Program
9 | {
10 | static void RefAsParameter( ref MyClass f1 )
11 | {
12 | // Assign to the object member.
13 | f1.Val = 50;
14 | Console.WriteLine( "After member assignment: {0}", f1.Val );
15 |
16 | // Create a new object and assign it to the formal parameter.
17 | f1 = new MyClass();
18 | Console.WriteLine( "After new object creation: {0}", f1.Val );
19 | }
20 |
21 | static void Main( string[] args )
22 | {
23 | MyClass a1 = new MyClass();
24 |
25 | Console.WriteLine( "Before method call: {0}", a1.Val );
26 | RefAsParameter( ref a1 );
27 | Console.WriteLine( "After method call: {0}", a1.Val );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter05/Page098/Page098/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public void ListInts( params int[] inVals )
6 | {
7 | if ( ( inVals != null ) && ( inVals.Length != 0 ) )
8 | for ( int i = 0; i < inVals.Length; i++ ) // Process the array.
9 | {
10 | inVals[i] = inVals[i] * 10;
11 | Console.WriteLine( "{0}", inVals[i] ); // Display new value.
12 | }
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | int first = 5, second = 6, third = 7; // Declare three ints.
21 |
22 | MyClass mc = new MyClass();
23 | mc.ListInts( first, second, third ); // Call the method.
24 |
25 | Console.WriteLine( "{0}, {1}, {2}", first, second, third );
26 | }
27 | }
--------------------------------------------------------------------------------
/Chapter17/Page442/Page442/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | static class ExtendHolder
4 | {
5 | public static void Print( this Holder h )
6 | {
7 | T[] vals = h.GetValues();
8 | Console.WriteLine( "{0},\t{1},\t{2}", vals[0], vals[1], vals[2] );
9 | }
10 | }
11 |
12 | class Holder
13 | {
14 | T[] Vals = new T[3];
15 |
16 | public Holder( T v0, T v1, T v2 )
17 | {
18 | Vals[0] = v0; Vals[1] = v1; Vals[2] = v2;
19 | }
20 |
21 | public T[] GetValues()
22 | {
23 | return Vals;
24 | }
25 | }
26 |
27 | class Program
28 | {
29 | static void Main( string[] args )
30 | {
31 | var intHolder = new Holder( 3, 5, 7 );
32 | var stringHolder = new Holder( "a1", "b2", "c3" );
33 |
34 | intHolder.Print();
35 | stringHolder.Print();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Chapter17/Page445/Page445/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | delegate void MyDelegate( T value ); // Generic delegate
4 | class Simple
5 | {
6 | static public void PrintString( string s ) // Method matches delegate
7 | {
8 | Console.WriteLine( s );
9 | }
10 |
11 | static public void PrintUpperString( string s ) // Method matches delegate
12 | {
13 | Console.WriteLine( "{0}", s.ToUpper() );
14 | }
15 | }
16 |
17 | class Program
18 | {
19 | static void Main()
20 | {
21 | var myDel = new MyDelegate( Simple.PrintString ); // Create inst of delegate.
22 | myDel += Simple.PrintUpperString; // Add a method.
23 | myDel( "Hi There." ); // Call delegate.
24 | }
25 | }
--------------------------------------------------------------------------------
/Chapter24/Page668/Page668/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection; // Must use this namespace
3 |
4 | namespace SimpleReflection
5 | {
6 | class BaseClass
7 | {
8 | public int MyFieldBase;
9 | }
10 |
11 | class DerivedClass : BaseClass
12 | {
13 | public int MyFieldDerived;
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | Type tbc = typeof( DerivedClass ); // Get the type.
21 | Console.WriteLine( "Result is {0}.", tbc.Name );
22 |
23 | Console.WriteLine( "It has the following fields:" ); // Use the type.
24 | FieldInfo[] fi = tbc.GetFields();
25 | foreach ( var f in fi )
26 | Console.WriteLine( " {0}", f.Name );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/Chapter07/Page172/Page172/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyBaseClass
4 | {
5 | virtual public void Print()
6 | {
7 | Console.WriteLine( "This is the base class." );
8 | }
9 | }
10 |
11 | class MyDerivedClass : MyBaseClass
12 | {
13 | override public void Print()
14 | {
15 | Console.WriteLine( "This is the derived class." );
16 | }
17 | }
18 |
19 | class SecondDerived : MyDerivedClass
20 | {
21 | new public void Print()
22 | {
23 | Console.WriteLine( "This is the second derived class." );
24 | }
25 | }
26 |
27 | class Program
28 | {
29 | static void Main() // Main
30 | {
31 | SecondDerived derived = new SecondDerived(); // Use SecondDerived.
32 | MyBaseClass mybc = (MyBaseClass) derived; // Use MyBaseClass.
33 | derived.Print();
34 | mybc.Print();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Chapter18/Page476/Page476/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | class MyClass
5 | {
6 | public IEnumerator GetEnumerator()
7 | {
8 | IEnumerable myEnumerable = BlackAndWhite(); // Get enumerable.
9 | return myEnumerable.GetEnumerator(); // Get enumerator.
10 | }
11 |
12 | public IEnumerable BlackAndWhite()
13 | {
14 | yield return "black";
15 | yield return "gray";
16 | yield return "white";
17 | }
18 | }
19 |
20 | class Program
21 | {
22 | static void Main()
23 | {
24 | MyClass mc = new MyClass();
25 |
26 | foreach ( string shade in mc )
27 | Console.Write( "{0} ", shade );
28 |
29 | foreach ( string shade in mc.BlackAndWhite() )
30 | Console.Write( "{0} ", shade );
31 | }
32 | }
--------------------------------------------------------------------------------
/Chapter20/Page574/Page574/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | static class DoStuff
5 | {
6 | public static async Task FindSeriesSum( int i1 )
7 | {
8 | int sum = 0;
9 | for ( int i=0; i < i1; i++ )
10 | {
11 | sum += i;
12 | if ( i % 1000 == 0 )
13 | await Task.Yield();
14 | }
15 | return sum;
16 | }
17 | }
18 |
19 | class Program
20 | {
21 | static void Main()
22 | {
23 | Task value = DoStuff.FindSeriesSum( 1000000 );
24 | CountBig( 100000 );
25 | CountBig( 100000 );
26 | CountBig( 100000 );
27 | CountBig( 100000 );
28 | Console.WriteLine( "Sum: {0}", value.Result );
29 | }
30 |
31 | private static void CountBig( int p )
32 | {
33 | for ( int i=0; i < p; i++ )
34 | ;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Chapter20/AsyncLambda/AsyncLambda/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using System.Windows;
3 |
4 | namespace AsyncLambda
5 | {
6 | public partial class MainWindow : Window
7 | {
8 | public MainWindow()
9 | {
10 | InitializeComponent();
11 |
12 | startWorkButton.Click += async ( sender, e ) =>
13 | {
14 | SetGuiValues( false, "Work Started" );
15 | await DoSomeWork();
16 | SetGuiValues( true, "Work Finished" );
17 | };
18 | }
19 |
20 | private void SetGuiValues( bool buttonEnabled, string status )
21 | {
22 | startWorkButton.IsEnabled = buttonEnabled;
23 | workStartedTextBlock.Text = status;
24 | }
25 |
26 | private Task DoSomeWork()
27 | {
28 | return Task.Delay( 2500 );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Chapter07/Page171/Page171/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyBaseClass
4 | {
5 | virtual public void Print()
6 | {
7 | Console.WriteLine( "This is the base class." );
8 | }
9 | }
10 |
11 | class MyDerivedClass : MyBaseClass
12 | {
13 | override public void Print()
14 | {
15 | Console.WriteLine( "This is the derived class." );
16 | }
17 | }
18 |
19 | class SecondDerived : MyDerivedClass
20 | {
21 | override public void Print()
22 | {
23 | Console.WriteLine( "This is the second derived class." );
24 | }
25 | }
26 |
27 | class Program
28 | {
29 | static void Main()
30 | {
31 | SecondDerived derived = new SecondDerived(); // Use SecondDerived.
32 | MyBaseClass mybc = (MyBaseClass) derived; // Use MyBaseClass.
33 |
34 | derived.Print();
35 | mybc.Print();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Chapter17/Page458/Page458/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Animal
4 | {
5 | public string Name;
6 | }
7 |
8 | class Dog : Animal
9 | {
10 | }
11 |
12 | interface IMyIfc
13 | {
14 | T GetFirst();
15 | }
16 |
17 | class SimpleReturn : IMyIfc
18 | {
19 | public T[] items = new T[2];
20 |
21 | public T GetFirst()
22 | {
23 | return items[0];
24 | }
25 | }
26 |
27 | class Program
28 | {
29 | static void DoSomething( IMyIfc returner )
30 | {
31 | Console.WriteLine( returner.GetFirst().Name );
32 | }
33 |
34 | static void Main()
35 | {
36 | SimpleReturn dogReturner = new SimpleReturn();
37 | dogReturner.items[0] = new Dog() { Name = "Avonlea" };
38 |
39 | IMyIfc animalReturner = dogReturner;
40 |
41 | DoSomething( dogReturner );
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Chapter07/Page198/Page198/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ExtensionMethods
4 | {
5 | sealed class MyData
6 | {
7 | private double D1, D2, D3;
8 |
9 | public MyData( double d1, double d2, double d3 )
10 | {
11 | D1 = d1;
12 | D2 = d2;
13 | D3 = d3;
14 | }
15 |
16 | public double Sum()
17 | {
18 | return D1 + D2 + D3;
19 | }
20 | }
21 |
22 | static class ExtendMyData
23 | {
24 | public static double Average( this MyData md )
25 | {
26 | return md.Sum() / 3;
27 | }
28 | }
29 |
30 | class Program
31 | {
32 | static void Main()
33 | {
34 | MyData md = new MyData( 3, 4, 5 );
35 | Console.WriteLine( "Sum: {0}", md.Sum() );
36 | Console.WriteLine( "Average: {0}", md.Average() );
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Chapter24/Page675/Page675/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics; // Required for this DebuggerStepThrough
3 |
4 | class Program
5 | {
6 | int _x = 1;
7 | int X
8 | {
9 | get { return _x; }
10 | [DebuggerStepThrough] // Don’t step through the set accessor.
11 | set
12 | {
13 | _x = _x * 2;
14 | _x += value;
15 | }
16 | }
17 |
18 | public int Y { get; set; }
19 |
20 | public static void Main()
21 | {
22 | Program p = new Program();
23 | p.IncrementFields();
24 | p.X = 5;
25 | Console.WriteLine( "X = {0}, Y = {1}", p.X, p.Y );
26 | }
27 |
28 | [DebuggerStepThrough] // Don’t step through this method.
29 | void IncrementFields()
30 | {
31 | X++;
32 | Y++;
33 | }
34 | }
--------------------------------------------------------------------------------
/Chapter05/Page107/Page107/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | double GetCylinderVolume( double radius = 3.0, double height = 4.0 )
6 | {
7 | return 3.1416 * radius * radius * height;
8 | }
9 |
10 | static void Main()
11 | {
12 | MyClass mc = new MyClass();
13 | double volume;
14 |
15 | volume = mc.GetCylinderVolume( 3.0, 4.0 ); // Positional
16 | Console.WriteLine( "Volume = " + volume );
17 |
18 | volume = mc.GetCylinderVolume( radius: 2.0 ); // Use default height
19 | Console.WriteLine( "Volume = " + volume );
20 |
21 | volume = mc.GetCylinderVolume( height: 2.0 ); // Use default radius
22 | Console.WriteLine( "Volume = " + volume );
23 |
24 | volume = mc.GetCylinderVolume(); // Use both defaults
25 | Console.WriteLine( "Volume = " + volume );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter19/Page502/Page502/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | class Program
8 | {
9 | static void Main()
10 | {
11 | var students = new[] // Array of objects of an anonymous type
12 | {
13 | new { LName="Jones", FName="Mary", Age=19, Major="History" },
14 | new { LName="Smith", FName="Bob", Age=20, Major="CompSci" },
15 | new { LName="Fleming", FName="Carol", Age=21, Major="History" }
16 | };
17 |
18 | var query = from student in students
19 | orderby student.Age
20 | select student;
21 |
22 | foreach ( var s in query )
23 | {
24 | Console.WriteLine( "{0}, {1}: {2} - {3}",
25 | s.LName, s.FName, s.Age, s.Major );
26 | }
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/Chapter19/Page538/Page538/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | XDocument xd = new XDocument(
9 | new XElement( "MyElements",
10 | new XElement( "first",
11 | new XAttribute( "color", "red" ),
12 | new XAttribute( "size", "small" )
13 | ),
14 | new XElement( "second",
15 | new XAttribute( "color", "red" ),
16 | new XAttribute( "size", "medium" )
17 | ),
18 | new XElement( "third",
19 | new XAttribute( "color", "blue" ),
20 | new XAttribute( "size", "large" )
21 | )
22 | )
23 | );
24 |
25 | Console.WriteLine( xd ); // Display XML tree.
26 | xd.Save( "SimpleSample.xml" ); // Save XML tree.
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/Chapter22/Page648/Page648/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public static void PrintArg( string arg )
6 | {
7 | try
8 | {
9 | try
10 | {
11 | if ( arg == null )
12 | {
13 | ArgumentNullException myEx = new ArgumentNullException( "arg" );
14 | throw myEx;
15 | }
16 | Console.WriteLine( arg );
17 | }
18 | catch ( ArgumentNullException e )
19 | {
20 | Console.WriteLine( "Inner Catch: {0}", e.Message );
21 | throw;
22 | }
23 | }
24 | catch
25 | {
26 | Console.WriteLine( "Outer Catch: Handling an Exception." );
27 | }
28 | }
29 | }
30 |
31 | class Program
32 | {
33 | static void Main()
34 | {
35 | string s = null;
36 | MyClass.PrintArg( s );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter06/Page118/Page118/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class D
4 | {
5 | int Mem1;
6 | static int Mem2;
7 |
8 | public void SetVars( int v1, int v2 ) // Set the values
9 | {
10 | Mem1 = v1;
11 | Mem2 = v2;
12 | }
13 |
14 | public void Display( string str )
15 | {
16 | Console.WriteLine( "{0}: Mem1= {1}, Mem2= {2}", str, Mem1, Mem2 );
17 | }
18 | }
19 |
20 | class Program
21 | {
22 | static void Main()
23 | {
24 | D d1 = new D(), d2 = new D(); // Create two instances.
25 |
26 | d1.SetVars( 2, 4 ); // Set d1's values.
27 | d1.Display( "d1" );
28 |
29 | d2.SetVars( 15, 17 ); // Set d2's values.
30 | d2.Display( "d2" );
31 |
32 | d1.Display( "d1" ); // Display d1 again and notice that the
33 | } // value of static member Mem2 has changed!
34 | }
35 |
--------------------------------------------------------------------------------
/Chapter19/Page504/Page504/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | class Program
5 | {
6 | static void Main()
7 | {
8 | var students = new[] // Array of objects of an anonymous type
9 | {
10 | new { LName="Jones", FName="Mary", Age=19, Major="History" },
11 | new { LName="Smith", FName="Bob", Age=20, Major="CompSci" },
12 | new { LName="Fleming", FName="Carol", Age=21, Major="History" }
13 | };
14 |
15 | var query1 = from s in students
16 | select s;
17 |
18 | foreach ( var q in query1 )
19 | Console.WriteLine( "{0}, {1}: Age {2}, {3}",
20 | q.LName, q.FName, q.Age, q.Major );
21 |
22 | Console.WriteLine();
23 |
24 | var query2 = from s in students
25 | select s.LName;
26 |
27 | foreach ( var q in query2 )
28 | Console.WriteLine( q );
29 | }
30 | }
--------------------------------------------------------------------------------
/Chapter16/Page414/Page414/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Person
4 | {
5 | public string Name;
6 | public int Age;
7 |
8 | public Person( string name, int age )
9 | {
10 | Name = name;
11 | Age = age;
12 | }
13 |
14 | public static implicit operator int( Person p ) // Convert Person to int.
15 | {
16 | return p.Age;
17 | }
18 |
19 | public static implicit operator Person( int i ) // Convert int to Person.
20 | {
21 | return new Person( "Nemo", i ); // ("Nemo" is Latin for "No one".)
22 | }
23 | }
24 |
25 | class Program
26 | {
27 | static void Main()
28 | {
29 | Person bill = new Person( "bill", 25 );
30 |
31 | int age = bill;
32 | Console.WriteLine( "Person Info: {0}, {1}", bill.Name, age );
33 |
34 | Person anon = 35;
35 | Console.WriteLine( "Person Info: {0}, {1}", anon.Name, anon.Age );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Chapter19/Page526/Page526/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq; // This namespace is required.
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | XDocument employeeDoc =
8 | new XDocument( // Create the document.
9 | new XElement( "Employees", // Create the root element.
10 | new XElement( "Employee", // First employee element
11 | new XElement( "Name", "Bob Smith" ),
12 | new XElement( "PhoneNumber", "408-555-1000" ) ),
13 | new XElement( "Employee", // Second employee element
14 | new XElement( "Name", "Sally Jones" ),
15 | new XElement( "PhoneNumber", "415-555-2000" ),
16 | new XElement( "PhoneNumber", "415-555-2001" ) )
17 | )
18 | );
19 |
20 | Console.WriteLine( employeeDoc ); // Displays the document
21 | }
22 | }
--------------------------------------------------------------------------------
/Chapter18/Page479/Page479/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | class Spectrum
5 | {
6 | string[] colors = { "violet", "blue", "cyan", "green", "yellow", "orange", "red" };
7 |
8 | public IEnumerable UVtoIR()
9 | {
10 | for ( int i=0; i < colors.Length; i++ )
11 | yield return colors[i];
12 | }
13 |
14 | public IEnumerable IRtoUV()
15 | {
16 | for ( int i=colors.Length - 1; i >= 0; i-- )
17 | yield return colors[i];
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main()
24 | {
25 | Spectrum spectrum = new Spectrum();
26 |
27 | foreach ( string color in spectrum.UVtoIR() )
28 | Console.Write( "{0} ", color );
29 | Console.WriteLine();
30 |
31 | foreach ( string color in spectrum.IRtoUV() )
32 | Console.Write( "{0} ", color );
33 | Console.WriteLine();
34 | }
35 | }
--------------------------------------------------------------------------------
/Chapter19/Page489/Page489/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | int[] numbers = { 2, 5, 28, 31, 17, 16, 42 };
10 |
11 | var numsQuery = from n in numbers // Query syntax
12 | where n < 20
13 | select n;
14 |
15 | var numsMethod = numbers.Where( x => x < 20 ); // Method syntax
16 |
17 | int numsCount = ( from n in numbers // Combined
18 | where n < 20
19 | select n ).Count();
20 |
21 | foreach ( var x in numsQuery )
22 | Console.Write( "{0}, ", x );
23 | Console.WriteLine();
24 |
25 | foreach ( var x in numsMethod )
26 | Console.Write( "{0}, ", x );
27 | Console.WriteLine();
28 |
29 | Console.WriteLine( numsCount );
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/Chapter05/Page100/Page100/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public void ListInts( params int[] inVals )
6 | {
7 | if ( ( inVals != null ) && ( inVals.Length != 0 ) )
8 | for ( int i = 0; i < inVals.Length; i++ ) // Process the array.
9 | {
10 | inVals[i] = inVals[i] * 10;
11 | Console.WriteLine( "{0}", inVals[i] ); // Display new value.
12 | }
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | int[] myArr = new int[] { 5, 6, 7 }; // Create and initialize array.
21 |
22 | MyClass mc = new MyClass();
23 | mc.ListInts( myArr ); // Call method to print the values.
24 |
25 | foreach ( int x in myArr )
26 | Console.WriteLine( "{0}", x ); // Print out each element.
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/Chapter07/Page164/Page164/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class SomeClass // Base class
4 | {
5 | public string Field1 = "SomeClass Field1";
6 |
7 | public void Method1( string value )
8 | {
9 | Console.WriteLine( "SomeClass.Method1: {0}", value );
10 | }
11 | }
12 |
13 | class OtherClass : SomeClass // Derived class
14 | {
15 | new public string Field1 = "OtherClass Field1"; // Mask the base member.
16 |
17 | new public void Method1( string value ) // Mask the base member.
18 | {
19 | Console.WriteLine( "OtherClass.Method1: {0}", value );
20 | }
21 | }
22 |
23 | class Program
24 | {
25 | static void Main()
26 | {
27 | OtherClass oc = new OtherClass(); // Use the masking member.
28 | oc.Method1( oc.Field1 ); // Use the masking member.
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Chapter20/Page593/Page593/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading; // For Thread.Sleep()
3 |
4 | delegate long MyDel( int first, int second ); // Declare delegate type.
5 |
6 | class Program
7 | {
8 | static long Sum( int x, int y ) // Declare method for async.
9 | {
10 | Console.WriteLine( " Inside Sum" );
11 | Thread.Sleep( 100 );
12 | return x + y;
13 | }
14 |
15 | static void Main()
16 | {
17 | MyDel del = new MyDel( Sum );
18 |
19 | Console.WriteLine( "Before BeginInvoke" );
20 | IAsyncResult iar = del.BeginInvoke( 3, 5, null, null ); // Start async
21 | Console.WriteLine( "After BeginInvoke" );
22 |
23 | Console.WriteLine( "Doing stuff" );
24 |
25 | long result = del.EndInvoke( iar ); // Wait for end and get result
26 | Console.WriteLine( "After EndInvoke: {0}", result );
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter06/Page136/Page136/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Class1
4 | {
5 | int Id;
6 | string Name;
7 |
8 | public Class1() // Constructor 0
9 | {
10 | Id = 28; Name = "Nemo";
11 | }
12 |
13 | public Class1( int val ) // Constructor 1
14 | {
15 | Id = val; Name = "Nemo";
16 | }
17 |
18 | public Class1( String name ) // Constructor 2
19 | {
20 | Name = name;
21 | }
22 |
23 | public void SoundOff()
24 | {
25 | Console.WriteLine( "Name {0}, Id {1}", Name, Id );
26 | }
27 | }
28 |
29 | class Program
30 | {
31 | static void Main()
32 | {
33 | Class1 a = new Class1(), // Call constructor 0.
34 | b = new Class1( 7 ), // Call constructor 1.
35 | c = new Class1( "Bill" ); // Call constructor 2.
36 |
37 | a.SoundOff();
38 | b.SoundOff();
39 | c.SoundOff();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Chapter25/Page696/Page696/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | string parseResultSummary;
8 | string stringFirst = "28";
9 | int intFirst;
10 |
11 | bool success = int.TryParse( stringFirst, out intFirst );
12 |
13 | parseResultSummary = success
14 | ? "was successfully parsed"
15 | : "was not successfully parsed";
16 | Console.WriteLine( "String {0} {1}", stringFirst, parseResultSummary );
17 |
18 | string stringSecond = "vt750";
19 | int intSecond;
20 | success = int.TryParse( stringSecond, out intSecond );
21 |
22 | parseResultSummary = success
23 | ? "was successfully parsed"
24 | : "was not successfully parsed";
25 | Console.WriteLine( "String {0} {1}", stringSecond, parseResultSummary );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter15/Page380/Page380/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | interface IIfc1 // Declare interface.
4 | {
5 | void PrintOut( string s );
6 | }
7 |
8 | interface IIfc2 // Declare interface
9 | {
10 | void PrintOut( string s );
11 | }
12 |
13 | class MyClass : IIfc1, IIfc2 // Declare class.
14 | {
15 | public void PrintOut( string s )
16 | {
17 | Console.WriteLine( "Calling through: {0}", s );
18 | }
19 | }
20 |
21 | class Program
22 | {
23 | static void Main()
24 | {
25 | MyClass mc = new MyClass();
26 |
27 | IIfc1 ifc1 = (IIfc1) mc; // Get ref to IIfc1.
28 | IIfc2 ifc2 = (IIfc2) mc; // Get ref to IIfc2.
29 |
30 | mc.PrintOut( "object" ); // Call through class object.
31 |
32 | ifc1.PrintOut( "interface 1" ); // Call through IIfc1.
33 | ifc2.PrintOut( "interface 2" ); // Call through IIfc2.
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Chapter08/Page227/Page227/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class Program
4 | {
5 | static void Main()
6 | {
7 | int x = 10, y = 9;
8 | int highVal = x > y // Condition
9 | ? x // Expression 1
10 | : y; // Expression 2
11 | Console.WriteLine( "highVal: {0}\n", highVal );
12 |
13 | Console.WriteLine( "x is{0} greater than y",
14 | x > y // Condition
15 | ? "" // Expression 1
16 | : " not" ); // Expression 2
17 |
18 | y = 11;
19 | Console.WriteLine( "x is{0} greater than y",
20 | x > y // Condition
21 | ? "" // Expression 1
22 | : " not" ); // Expression 2
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/Chapter24/Page666/Page666/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection; // Must use this namespace
3 |
4 | class BaseClass
5 | {
6 | public int BaseField = 0;
7 | }
8 |
9 | class DerivedClass : BaseClass
10 | {
11 | public int DerivedField = 0;
12 | }
13 |
14 | class Program
15 | {
16 | static void Main()
17 | {
18 | var bc = new BaseClass();
19 | var dc = new DerivedClass();
20 |
21 | BaseClass[] bca = new BaseClass[] { bc, dc };
22 |
23 | foreach ( var v in bca )
24 | {
25 | Type t = v.GetType(); // Get the type.
26 |
27 | Console.WriteLine( "Object type : {0}", t.Name );
28 |
29 | FieldInfo[] fi = t.GetFields(); // Get the field information.
30 | foreach ( var f in fi )
31 | Console.WriteLine( " Field : {0}", f.Name );
32 | Console.WriteLine();
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Chapter05/Page082/Page082/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | class MyClass
4 | {
5 | public int Sum( int x, int y ) // Declare the method.
6 | {
7 | return x + y; // Return the sum.
8 | }
9 |
10 | public float Avg( float input1, float input2 ) // Declare the method.
11 | {
12 | return ( input1 + input2 ) / 2.0F; // Return the average.
13 | }
14 | }
15 |
16 | class Program
17 | {
18 | static void Main()
19 | {
20 | MyClass myT = new MyClass();
21 | int someInt = 6;
22 |
23 | Console.WriteLine
24 | ( "Newsflash: Sum: {0} and {1} is {2}",
25 | 5, someInt, myT.Sum( 5, someInt ) ); // Invoke the method.
26 |
27 | Console.WriteLine
28 | ( "Newsflash: Avg: {0} and {1} is {2}",
29 | 5, someInt, myT.Avg( 5, someInt ) ); // Invoke the method.
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter02/Page16/Page16.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page16", "Page16\Page16.csproj", "{B0FF7528-2886-4191-8AE2-2D8C718C3F70}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {B0FF7528-2886-4191-8AE2-2D8C718C3F70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {B0FF7528-2886-4191-8AE2-2D8C718C3F70}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {B0FF7528-2886-4191-8AE2-2D8C718C3F70}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {B0FF7528-2886-4191-8AE2-2D8C718C3F70}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter02/Page27/Page27.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page27", "Page27\Page27.csproj", "{E5E46502-1FCA-4770-B0D3-D4C33156C89D}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {E5E46502-1FCA-4770-B0D3-D4C33156C89D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {E5E46502-1FCA-4770-B0D3-D4C33156C89D}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {E5E46502-1FCA-4770-B0D3-D4C33156C89D}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {E5E46502-1FCA-4770-B0D3-D4C33156C89D}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter19/Page506/Page506/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 |
5 | class Program
6 | {
7 | static void Main()
8 | {
9 | var students = new[] // Array of objects of an anonymous type
10 | {
11 | new { LName="Jones", FName="Mary", Age=19, Major="History" },
12 | new { LName="Smith", FName="Bob", Age=20, Major="CompSci" },
13 | new { LName="Fleming", FName="Carol", Age=21, Major="History" }
14 | };
15 |
16 | var query = from student in students
17 | group student by student.Major;
18 |
19 | foreach ( var s in query ) // Enumerate the groups.
20 | {
21 | Console.WriteLine( "{0}", s.Key );
22 |
23 | foreach ( var t in s ) // Enumerate the items in the group.
24 | Console.WriteLine( " {0}, {1}", t.LName, t.FName );
25 | }
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/Chapter04/Page064/Page064.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page064", "Page064\Page064.csproj", "{7D3FCA52-80CD-425B-BBFF-434836FA1F00}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {7D3FCA52-80CD-425B-BBFF-434836FA1F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {7D3FCA52-80CD-425B-BBFF-434836FA1F00}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {7D3FCA52-80CD-425B-BBFF-434836FA1F00}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {7D3FCA52-80CD-425B-BBFF-434836FA1F00}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter04/Page065/Page065.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page065", "Page065\Page065.csproj", "{4C601D8C-E297-467F-BE7F-49FB8DA508A1}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {4C601D8C-E297-467F-BE7F-49FB8DA508A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {4C601D8C-E297-467F-BE7F-49FB8DA508A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {4C601D8C-E297-467F-BE7F-49FB8DA508A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {4C601D8C-E297-467F-BE7F-49FB8DA508A1}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter05/Page075/Page075.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page075", "Page075\Page075.csproj", "{C4F9A62E-57AA-4136-9B6E-EB7EAF2E52C4}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {C4F9A62E-57AA-4136-9B6E-EB7EAF2E52C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {C4F9A62E-57AA-4136-9B6E-EB7EAF2E52C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {C4F9A62E-57AA-4136-9B6E-EB7EAF2E52C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {C4F9A62E-57AA-4136-9B6E-EB7EAF2E52C4}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter05/Page077/Page077.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page077", "Page077\Page077.csproj", "{5112DC3E-1822-4170-B334-C94A57C07ABB}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {5112DC3E-1822-4170-B334-C94A57C07ABB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {5112DC3E-1822-4170-B334-C94A57C07ABB}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {5112DC3E-1822-4170-B334-C94A57C07ABB}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {5112DC3E-1822-4170-B334-C94A57C07ABB}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter05/Page079/Page079.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page079", "Page079\Page079.csproj", "{E881F313-910F-4AF8-9C2B-E5A6CF9A893E}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {E881F313-910F-4AF8-9C2B-E5A6CF9A893E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {E881F313-910F-4AF8-9C2B-E5A6CF9A893E}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {E881F313-910F-4AF8-9C2B-E5A6CF9A893E}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {E881F313-910F-4AF8-9C2B-E5A6CF9A893E}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Chapter05/Page082/Page082.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 11
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Page082", "Page082\Page082.csproj", "{78D52727-1A11-4F22-BD6D-F4C73E080369}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {78D52727-1A11-4F22-BD6D-F4C73E080369}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {78D52727-1A11-4F22-BD6D-F4C73E080369}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {78D52727-1A11-4F22-BD6D-F4C73E080369}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {78D52727-1A11-4F22-BD6D-F4C73E080369}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------