- ?? operator, 226–227
- ? operators, 101
- & operator, 81, 87–88, 235
- && operator, 87–88
- @ sign
- Razor runtime compilation
- arrays, 772–773
- logical statements, 771–772
- loops, 772–774
- syntax, 766–767
- verbatim string operator, 39
- | operator, 87, 235
- || operator, 87–88
- + symbol, 16
- ++n increment operator, 84, 122
- < operator, 81
- <= operator, 85
- <T> notation, 142
- > operator, 81, 89
- >= operator, 85
- ' ' character constant, 37, 38
- '
' character constant, 37, 62
- ' ' character constant, 20, 37, 592
- 'x' numeric constants, 43
- [Conditional(“DEBUG”)] attribute, 302
- [Obsolete] attribute, 302
- 32-bit applications, 591
- 32-bit integers, 29
- 32-bit platforms, 596–597, 611
A
- Abs function, 87
- abstract classes
- factoring, 369, 371–374
- general discussion, 244, 368, 374–377
- interfaces for managing changes, 404–405
- Object Oriented Programming (OOP), 244
TextReader
/
TextWriter
class, 527
- UML, 370
- abstract keyword, 479
- access control. See also security
- accessor methods, 308–309
- assemblies
internal
access modifier, 448–451
- overview, 448
protected internal
access modifier, 452–453
- base class method
- accidental hiding, 359–361
- hiding, 355–359
- class, 306–308
- classes
- covariant return type, 319–320
- expression-bodied members, 329–331
init-only
setters, 309–310
internal
access modifier, 307
- overview, 303–304
- properties, 313–316
protected
access modifier, 307, 434
protected internal
access modifier, 307, 434
public
access modifier, 247–249, 306
- sealing, 377–378
- target typing, 316–318
- constructors
- C#-provided, 321–322
- example, 324–325
- initializers, 326–327
- initializers without constructors, 327–329
- overview, 309, 320–321
- replacing default, 322–324
DoubleBankAccount
program example, 311–313
- in namespaces, 456–458
private
access modifier
- assemblies, 451–452
- class, 304–306
readonly
keyword, 485–487
- Windows applications, 507
- access modifiers
private
- access control, 271–273
- assemblies, 451–452
- fields, 479
- general discussion, 245, 304–306
- scope, 288–290
- AccessControl namespace, 508
- accessor methods, 308–309
- AccessRule namespace class, 508
- Action keyword, 413–415
- Active Server Pages (ASP). See also ASP.NET Core applications
- Razor runtime compilation, 761, 762
- VBScript scripting language, 576
- Adapter class, 511, 515
- adapters, 191
- Add() method, 146, 150
- addition operator
- general discussion, 38, 81, 82
- overloading, 92–93
struct
keyword, 484–485
- AddRange() method, 151–152
- ADO.NET
- DataSet class, 396–399
- SQL, 510–512
- Stored Procedures, 524
- Advanced Encryption Standard (AES), 507
- algorithms, 41
- allocation, 477
- alphabets, 36–37, 529
- ALU (Arithmetic Logic Unit), 33–34
- American National Standards Institute (ANSI), 529
- American Standard Code for Information Interchange (ASCII), 162, 529
- and operator, 81, 87–88, 235
- and/or operator, 87, 235
- Android Application Development All-in-One For Dummies (Burd & Mueller), 725
- Android Developer Studio, 725
- Android operating system, 590, 593, 725
- Angular templates, 597, 754
- anonymous methods, 109, 421–424, 585–586
- ANSI (American National Standards Institute), 529
- Apache Cordova software, 593
- Append() method, 78–79
- Application Programming Interfaces (APIs), 388, 485–487, 545
- Arabic alphabet, 36–37, 529
- Architectural Layer Diagrams, 594
- Architecture Validation, 594
- ArgumentException, 212, 217
- ArgumentOutOfRangeException, 212, 216–217
- arguments
- default arguments, 278–279
- matching definitions, 276
- overloading, 276–278
- passing to static method, 273–275
- reference structures and, 488
- Arithmetic Logic Unit (ALU), 33–34
- arithmetic operators
- general discussion, 26, 91
- increment operator, 84–85
- operating orders, 82–83
- simple, 82
- ARM processors, 596–597
- arrays. See also tuples
- adding structures to, 489–490
- collections, 125, 140–141, 147–149
- converting to lists, 144
- double brackets, 127, 141
- enumerators, 134–136
- fixed-value arrays, 127, 128
foreach
loop method, 133–136
- initializing, 132, 147–148
- interfaces as base type of, 389–390
- limitations, 140–141
- purpose, 126–127
- Razor runtime compilation, 772–773
- resource use, 477
- sorting, 136–139
- specialized features, 128
- syntax, 127, 129
var
keyword, 139–140
- variable-length, 129–132
- zero in, 58, 66, 127
- artifacts, 500
- artificial intelligence, 576, 577
- as operator, 189, 349–350
- ASCII (American Standard Code for Information Interchange), 162, 529
- ASP.NET Core applications. See also Active Server Pages (ASP)
- basic app development
- adding web content, 757–759
- basic changes, 759–760
- development process, 756–757
- overview, 754
- project creation, 754–756
- general discussion, 9, 745–747
- Razor runtime compilation
- arrays, 772–773
- changing web page data, 768–770
- comparison to predecessors, 762–763
- file layout, 763–764, 766
- logical statements, 771–772
- loops, 772–774
- output options, 767–768
- overview, 748, 761–762
- syntax, 766–767
- variables, 770
- Web Forms templates, 764–765
- serialization, 528, 775–778
- templates
- Empty template, 746–748
- HTTPS option, 749–750
- MVC paradigm, 751–752
- others, 753–754
- overview, 746
- third-party software, 753–754
- Web API, 752–753
- Web App template, 748–749
- tracing, 556–558, 593
WeatherForecast
project
- API functionality, 783–786
- companion files, 775
- creating project, 778–781
- overview, 775–776
- realistic output, 781–783
RetrieveWeatherForecast
project, 786–793
- serialized data, 777–778
- assemblies
- access modifiers, 451–453
- class libraries
- access control keywords, 448–453
- adding projects to existing solutions, 442–445
- code, 445–446
- overview, 222, 437, 439
- projects, 439–440
- stand-alone, 440–442
- test applications, 446–447
- executable programs, 437–439
- general discussion, 288, 433
- assembly language, 438
- assignment operator, 26, 84, 91
- asynchronous input/output (I/O), 527, 528
- at sign
- Razor runtime compilation
- arrays, 772–773
- logical statements, 771–772
- loops, 772–774
- syntax, 766–767
- verbatim string operator, 39
- attached property, 649
- attributes, 236, 290, 301–302
- AuditRule namespace class, 508
- authentication
Authentication
class, 548
- MFA, 499–500
- Windows login, 503–506
- authorization
Authorization
namespace, 508, 548
System.Security
namespaces, 506, 508
- auto-implemented properties, 314
- autoindenting, 100
- Azure development, 593, 597
B
- backing fields property, 314
- backslash character, 37, 534
- base class methods, 355–361
- binary arithmetic, 87–88
- binary base
- binary subtraction operator, 81, 82
BinaryReader/Writer
class, 528, 539–540
- general discussion, 30
- binary input/output (I/O), 528, 539–540
- biometric devices, 499–500
- bit values, 235–236
- bitmap graphic format, 559, 563, 574
- bitwise operators, 87
- black box problem, 511–512
- Blazor templates, 597
- boilerplate code, 20
- bool numeric constants, 43
- bool variable type
- intrinsic variable types, 39
is
operator invalid conversions, 348–349
- logical comparison operators, 36, 85–88
as
operator invalid conversions, 349–350
- boxing, 188, 189, 477–478
- braces, 19, 97
- break statement
- loops, 115–116, 123–124
while
loop statements, 116–120
- browser-based Integrated Development Environment (IDE), 590
- bubble sort, 136–139
- BufferedStream class, 541
- buffering, 541
- built-in generics, 187–189
- byte integer type, 29, 234
- bytes, 235–236
C
- C programming language, 36
- C# 4.0 programming language, 465
- C# 7.2 programming language, 485–487
- C# 8.0 programming language
- interfaces after, 381–386
- nullable reference types, 469
- C# 9.0 programming language
- anonymous methods, 421–424
- CAS, 501
- classes and objects, 252–253
- elements since, 59–60, 411, 475
- C# 10.0 programming language
- best practices
'
'
constant, 37, 252
- anticipating problems, 209
- avoiding
!=
comparison operator, 52
- avoiding
==
comparison operator, 52
- braces, 19, 97
- comments, 19, 247, 264
- defining important constants, 104
- double-clicking error entries, 276
- elegance as a goal, 345
EventHandler
delegate type, 426
- exception-handling strategy, 221–225
- explaining user errors, 120
- form class use, 418
- indentation, 100
- last-chance exception-handling, 223, 225
- local functions, 301
- method argument values, 275
- methods naming conventions, 264
- .NET Framework predefined exceptions, 215–216
- no more than necessary access, 308
- nulling invalid references, 533
- object variable references, 255
- object-initializer syntax, 329
- plain-English error displays, 225
- properties versus fields, 248
- protecting casts, 348–350
- short and specific
try
blocks, 211
- spare use of
virtual
keyword, 368
- specific
catch
blocks, 212
ToString()
method, 295
- variable names, 247
- viewing warnings as errors, 360
Write()
method, 252
- C# Code Snippets feature, 20
- CAS, 501
- general discussion, 1–4, 9
- Help Index, 51–52, 84, 87
- Language Help file, 224
- multiple inheritance disallowed, 387
- online interaction, 23
- properties, 248
- supported pattern types, 110
- top-level statements, 20–21
- C# Code Snippets feature, 20
- C# modules. See assemblies
- C++ Cross-Platform Library Development software, 593
- C++ programming language
- COM language, 575–580
- destructors, 330, 350
- function pointers, 409, 411
- general discussion, 9
- logical variable types, 36
- UWP, 724
- cache, 545
- callback methods, 407–408
- call-by-reference feature, 280–281
- CAN_BE_USED_AS relationship
- example program, 391–396
- general discussion, 379–381
- capitalization, 18, 56–58, 247
- carriage return character, 37, 62
- CAS (Code Access Security), 501
- cast operator, 90–91
- casts
- general discussion, 44–45
- invalid runtime, 347–348
is
operator invalid conversions, 348–349
as
operator invalid conversions, 349–350
- type-safety and, 188
- catch blocks, 210–212
- Celsius scale, 30–31, 32
- chaining, 336–338
- char character type, 36–37
- character constants, 43
- character types
char
character type, 36–37
- comparison, 40–41
string
- changing case, 56–58
- common operations, 51–52
- comparing, 52–56
- example, 243
- formatting, 72–76, 77
- immutability, 50–51
- instantiating list for, 143–144
- looping, 58
- null, 37, 38, 204–205
- output manual control, 67–72
- overview, 37–39, 48–49
- searching, 59–61
StringBuilder
class, 77–79
switch
statement, 56–58
- user input, 61–66
- cheat sheet, 3
- child class, 244–245
- Chinese language, 529
- Chonoles, Michael Jesse, 370
- CipherAlgorithmType namespace class, 508
- class constraint, 204
- class constructor, 323–324
- class definition, 247–249
- class factoring, 369, 371–374
- class hierarchies, 396–399
- class libraries
- access control keywords, 448–453
- adding projects to existing solutions, 442–445
- code, 445–446
- general discussion, 222, 437, 439
- projects, 439–440
- stand-alone, 440–442
- test applications, 446–447
- class members
- general discussion, 257–258
- security
internal
access modifier, 307
private
access modifier, 304–306
protected
access modifier, 307, 434
protected internal
access modifier, 307, 434
public
access modifier, 247–249, 306
- class properties
- accessors with access levels, 316
- general discussion, 246, 257–258
- iterator blocks, 180, 183–185
- classes. See also partial classes
- abstract
- factoring, 369, 371–374
- interfaces for managing changes, 404–405
- Object Oriented Programming (OOP), 244
- overview, 244, 368, 374–377
TextReader
/
TextWriter
class, 527
- UML, 370
- access modifiers, 245
- data members, 257–259
- elements, 246
- exception handling, 244–245
- general discussion, 243
- inheritance
- avoiding
as
operator invalid conversions, 349–350
- avoiding invalid runtime casts, 347–348
- avoiding
is
operator invalid conversions, 348–349
BankAccount
class example, 335–342
- chaining, 336–338
- containment versus, 343–345
- destructors, 330, 350–351
HAS_A
relationship, 345, 346
IS_A
relationship, 335, 342–345, 346, 347
- overview, 168, 244–245, 333–334
- purpose, 334–335
- substitutable classes, 346–347
- tracking features, 339–342
- instantiating, 246
- interfaces for unifying, 391–396
- name capitalization, 247
- in namespaces
- access control keywords, 456–458
- declaring, 454–455
- file-scoped, 456
- nested, 455
- overview, 453–454
- partial classes, 433, 459–463
- partial methods, 433, 463–464
- purpose, 454
- using fully qualified, 458–459
- nesting, 256–257
- objects
- accessing members, 249
- C# 9.0 code, 252–253
- class definition, 247–249
- discriminating, 253
- instantiating, 246
- passing to instance methods, 288–290
- properties, 257–258
- reference types, 254–255
- traditional code, 250–252
- polymorphism, 244–245
- sealing, 377–378
- structures compared with, 475, 476–477
- ClassFileStream class, 541
- ClickOnce technique, 507–508
- cloud development, 593
- cloud projects, 593, 597
- CLR. See Common Language Runtime
- cmd.exe command, 18
- COBOL programming language, 127, 402–403
- Code Access Security (CAS), 501
- Code Clone feature, 594
- Code Coverage feature, 595
- code regions, 16
- CodeAccessPermission namespace class, 508
- CodeLens feature, 594
- Cold Fusion programming language, 577
- collection classes
<T>
notation, 142
- arrays, 125, 140–141, 147–149
- dictionaries, 142, 145–147
foreach
loop method, 164–168
- general discussion, 67
- indexers
- format, 169
- overview, 169–173
- sample program, 170–173
struct
keyword, 483–484
- information storage, 512
- initialization techniques, 147–149
- interfaces as base type of, 389–390
- iterator blocks
- example, 176–177
- other forms, 180–185
- overview, 173–175
yield break
statement, 178, 179–180
yield return
statement, 178–179
- lists
- converting to arrays, 144
- instantiating for
int
, 144
- instantiating for
string
, 143–144
- other tasks, 145
- overview, 125, 126, 143–144
- searching, 144–145
LoopThroughFiles
program
- files list creation, 159–160
- formatting output lines, 160–161
- hexadecimal output, 161–163
- overview, 156–159
- Visual Studio 2022, 163–164
- main classes, 141–142
- purpose, 177–178
- sets
- adding items, 150
- creating, 150
- difference operation, 149, 153
- intersection operation, 149, 152–153
- overview, 149
- special tasks, 149
- union operation, 149, 151–152
- syntax, 140–141
- types, 164–167
- colon character, 236, 646
- COM (Component Object Model) language, 575–580
- Command pattern
- built-in commands, 711–713
- custom commands, 713–717
ICommand
interface, 709–710
- routed commands, 710–711, 717–718
- traditional event handling, 707–709
- command prompt
- console applications and, 7
- general discussion, 589
- opening, 18
- Visual Studio 2022, 622
- comma-separated value (CSV), 777–778
- comments, 19, 223–224, 264
- Common Language Runtime
enum
limitations, 234
- general discussion, 437
- WPF applications
- application-scoped resource, 647–648
- building, 644–649
- login authentication, 503–506
- overview, 9, 604, 607–608, 641
- purpose, 642–643
- XAML, 605–607, 643–644, 650–651
- Compare() method, 52–56
- CompareTo() method, 392–394
- compiler, 13
- compile-time errors, 188
- Component Object Model (COM) language, 575–580
- compound assignment operators, 84
- compound logical operators, 87–88
- computer languages. See specific computer languages
- computer memory. See memory
- Concat() formatting method, 67, 71–72
- Concatenate() formatting method, 69–71
- concatenation, 41, 66, 77–79
- conditional expressions, 96–97, 102, 115–116
- console applications
- creating
- default program location, 15–16
- executing, 17–18
- overview, 11
- reviewing, 18–20
- source program, 11–15
- testing, 16
- Toolbox window, 21–22
- top-level statements, 20–21
- general discussion, 7–8, 598
- user input
- concatenating, 66
- excess white space, 62
- overview, 61–62
- parsing, 62–64
- series of numbers, 64–66
- Console.Read() call, 407
- Console.WriteLine() method, 339–342
- Console.WriteLine() statement, 20, 262–263
- const data members, 259
- constants, 259, 481.See also specific constants
- constraints, 202–204
- constructors
- access control
- C#-provided, 321–322
- example, 324–325
- initializers, 326–327
- initializing objects without constructors, 327–329
- overview, 309, 320–321
- replacing default, 322–324
- chaining, 336–338
- example, 324–325
- initializers, 326–329
protected internal
access modifier, 309, 434
- replacing default, 322–324
struct
keyword, 480
- containment, 343–345
- Contains() method, 59
- ContainsKey() method, 146
- continue statement, 115–116
- contravariance, 205, 206–208
- control-versus-productivity issue
- optional parameters and, 465
- parameters
- named parameters, 470
- null parameters, 473–474
- optional parameters, 465–469
- output parameters, 471–472
- return values, 470–473
- Convert class, 45, 62–64
- Cookie class, 548
- Count() method, 200–201
- counting numbers
- floating-point conversion, 44–45
- floating-point variables and, 32–34
- general discussion, 27
- counting variables, 114, 122
- coupling, 202
- covariance, 205–206, 208
- covariant return type, 319–320
- crashes, 214, 222
- Create, Read, Update, and Delete (CRUD) principles, 776
- Create() method, 284
- CreatePackage() method, 192
- cribbage board project
- board creation, 570–572
- debugging as learning aid, 623–626
- event handlers, 569–570
- first steps, 565–566
- general discussion, 565
- new game start method, 574
- project setup, 567
- score handling, 567–569
- score printing, 572–573
- cross-platform support
- UWP applications, 721–722, 725–726
- Visual Studio Community edition software, 13, 593
- Visual Studio Enterprise edition software, 595
- Xamarin platform, 10, 593, 595
- CRUD (Create, Read, Update, and Delete) principles, 776
- CryptoConfig namespace class, 508
- CryptoStream class, 541
- CShell application, 589, 591
- CSV (comma-separated value), 777–778
- Ctrl+K shortcut, 20
- Ctrl+S shortcut, 20
- CultureInfo.InvariantCulture property, 57–58
- curly braces, 19, 97
- current object, 296–300
- Current property, 166–168
- custom delegates, 409–410
- custom exceptions, 220
- cw shortcut, 20
- Cyrillic alphabet, 36–37
D
- data access
- connecting to data source, 514–519
- creating access application, 514
- data containers, 509, 511, 512
- general discussion, 509–512
- getting to data, 512–513
- RAD data tools, 519–521
- sample database setup, 513–514
- writing data code, 521–524
- data binding
- binding objects, 683–687
- converting data, 697–704
- dependency properties, 682
- editing data, 687–693
- general discussion, 681
- modes, 683
- other aspects, 705
- validating data, 693–697
- data collections. See specific collection classes
- data containers, 509, 511, 512, 596–597
- data generators
- API functionality, 783–786
- creating project, 778–781
- realistic output, 781–783
- data members
const
, 259
- initialization techniques, 299–300
readonly
, 259
- static properties, 257–258
- data serialization
- API configuration and functionality, 783
- API functionality, 784–786
- common storage methods, 777–778
- companion files, 775
- creating project, 778–781
- need for, 776
- realistic output, 781–783
RetrieveWeatherForecast
project, 786–793
- serialized data, 777–778
- Data View feature, 609–610
- database
- connecting to data source, 514–519
- creating access application, 514
- data containers, 509, 512
- general discussion, 509–524
- getting to data, 512–513
- RAD data tools, 519–521
- sample database setup, 513–514
- writing data code, 521–524
- DataReader container, 512
- DataRow container, 511, 512
- DataSet class, 399–401
- DataSet container, 509, 511, 512
- DataTable container, 509, 511, 512
- DataView container, 509, 511, 512
- DateTime variable type, 41–42
- DayOfWeek property, 42
- DbCommand, 511
- DbConnection, 511
- deallocation, 477
- debugging
- inheritance and, 334
- as learning aid, 623–626
- Snapshot Debugger feature, 595
- Time Travel Debugging feature, 595
- tracking inheritance, 339–342
- Visual Studio support, 592
- decimal numeric constants, 43, 44–45
- decimal variable type, 34–35, 234
- decimal.Round() statement, 114
- declarations, 27–28, 362–363, 493–494
- decoupling, 202
- decrement operators, 85
- default arguments, 278–279
- default parameters, 278–279
- delegate signature, 412–413
- delegate types, 413–415
- delegates
- anonymous methods and, 421–424
- callback methods, 407–408
- common uses, 411
- defining, 408–411
- events
- Observer design pattern, 425
- overview, 424–425, 430
- Publish/Subscribe pattern, 425–431
- examples
- delegate types, 413–415
- progress bar sample app, 415–420
- simple example, 412–413
- life cycle, 409–410
LoopThroughFiles
program, 165
- signature, 412–413
- delimiters, 64
- denial of service, 502–503
- dependencies, 202, 403–404
- dependency injection, 405–406
- dependency properties, 682
- Dequeue() method, 199–200
- DescendingEvens() method, 181–183
- DESCryptoServiceProvider namespace class, 508
- deserialized data, 775, 789–792
- design patterns, 425
- Design Patterns (Gamma, Helm, Johnson, & Vlissides), 425, 707
- designer
- Data View feature, 609–610
- general discussion, 603–604
- UWP application, 604–607
- WinForms application, 609
- WPF application, 607–609
- destructors, 330, 350–351
- Developer Mode
- adding background code, 738–739
- choosing test device, 739–740
- creating interface, 734–737
- defining project, 732–734
- device settings, 728–729
- File Explorer settings, 730
- general discussion, 725–732
- PowerShell settings, 732
- Remote Desktop, 730–731
- sideloading, 727–728
- Device Independent Units (DIUs), 654
- Dictionary<TKey, TValue> collection class
- creating, 145–146
- general discussion, 142, 145
- iterating, 146–147
- methods, 147
- searching, 146
- difference operation, 149, 153
- directories,
LoopThroughFiles
program
- files list creation, 159–160
- formatting output lines, 160–161
- hexadecimal output, 161–163
- overview, 156–159
- Visual Studio 2022, 163–164
- Directory class, 158
- DirectX, 724
- discard parameters, 423
- Display() method, 391–392
- DisplayRatio() method, 281–282
- Dispose() method, 351
- DIUs (Device Independent Units), 654
- division operator, 82
- .
dll
file extension
- access control keywords, 448–453
- adding projects to existing solutions, 442–445
- code, 445–446
- general discussion, 14, 307, 437, 439
- projects, 439–440
- stand-alone, 440–442
- test applications, 446–447
- DNS (Domain Name Services) class, 548
- Docker tools, 593, 746–747
- Don't Repeat Yourself (DRY) principle, 244
- DOS command line, 18
- dot hierarchy, 258, 455
- Dots Per Inch (DPI), 654
- double brackets, 127, 141
- double numeric constants, 43
- double quotation marks, 36, 40. See also string constants
- double variable type
enum
keyword limitation, 234
- example, 243
- general discussion, 32
- intrinsic variable types, 39
- numeric constants, 43
- DoubleBankAccount program example, 311–313
- Double.Epsilon constant, 87
- doubleVariable variable type, 33
- do…while loop statements, 114–115
- Download class, 548
- DPI (Dots Per Inch), 654
- drawing
- cribbage board project
- board creation, 570–572
- event handlers, 569–570
- first steps, 565–566
- new game start method, 574
- overview, 565
- project setup, 567
- score handling, 567–569
- score printing, 572–573
- DRY (Don't Repeat Yourself) principle, 244
- DumpBuffer() method, 161–163
- DumpHex() method, 159–161
- duration property, 42
- dynamic keyword, 148–149, 578–580
- Dynamic Language Runtime, 582–584
- dynamic programming
- anonymous/lambda methods, 109, 421–424, 585–586
- Dynamic Language Runtime, 582–584
- dynamic languages, 576–578
- dynamic operations, 580–582
- dynamic types, 47, 575–576
- dynamic variables, 575, 578–582
- techniques, 578–580
var
keyword, 575, 580–582
E
- e parameters, 427–429, 431
- early binding, 362–363
- element binding, 693. See also data binding
- elevation of privilege, 502–503
- else statement, 100–102
- email, 544, 546, 553–556
- embedded
if
statements, 102–104
- empty methods, 265–268
- empty
string
, 38
- Empty template, 746–748
- encapsulation, 244, 290, 333. See also access control
- encryption, 507, 508
- EndPoint class, 548
- endregion directive, 16
- Enqueue() method, 199
- enum keyword, 231–232, 234
- enumerated flags, 229, 235–236
- enumerated switches, 230, 237–238
- enumerators
- advantages, 165–167
- arrays, 134–136
- CLR limitations, 234
- defining switches, 230, 237–238
enum
keyword, 231–232, 234
- flags, 229, 235–236
- general discussion, 108, 155, 195, 229–230
- generic, 184
- initializers, 229, 233
- interfaces, 134–135, 165–168
LoopThroughFiles
program
- files list creation, 159–160
- formatting output lines, 160–161
- hexadecimal output, 161–163
- overview, 156–159
- Visual Studio 2022, 163–164
- methods extension, 238–239
- named, 180, 181–183
- real-world examples, 231–232
- specifying data type, 234–235
- equal to operator, 81
- equals symbol, 26, 84, 91
- error-handling. See compile-time errors; exception handling; runtime errors
- event handling, 569–570, 707–709
- event objects, 425–427
- EventHandler delegate type, 426
- EventHandler<TEventArgs> delegate type, 426
- events
- general discussion, 407, 424–431
- Observer design pattern, 425
- Publish/Subscribe pattern
- advertising, 426
- handler method, 430–431
- overview, 425–426
- raising events, 427–429
- subscribing, 427
- Evidence namespace class, 508
- exception handling
- benefits, 215
- classes, 244–245
- custom exceptions, 220
- strategy, 221, 222–225
- thrown exceptions
catch
blocks, 210–212
- example, 216–219
finally
blocks, 210–211, 212–213
- last-chance handling, 223, 225
- null coalescing operator technique, 226–227
- programmer-thrown exceptions, 215–216
- sequence of events, 213–215
throw
blocks, 210–211, 215
try
blocks, 210–211
try…catch
blocks
- factorial calculation example, 216–219
- nesting, 213
- overview, 76, 210, 225
- Exception object class, 211–212
- exceptions, 210–211
- exclusive or (xor) operator, 87, 235
- executable programs
- dividing programs into multiple, 437, 438–439
- general discussion, 8, 307, 435, 598
- ExecutionEngineException, 215–216
- explicit type conversions, 90–91
- expression body property, 314
- expression types
- assigning types, 91
- calculating types, 89–91
- general discussion, 89
- operator overloading, 92–93
- expression-bodied members, 329–331
- Extensible Application Markup Language. See XAML
- Extensible Markup Language. See XML
- Extensions class, 238–239
F
- facial recognition, 500
- Factorial() function, 216–219
- factoring, 369, 371–374
- factory methods
- dependency injection, 405–406
- general discussion, 197, 202, 389
- interfaces for hiding, 399–401
- Fahrenheit scale, 30–31, 32
- false numeric constants, 43
- false value, 36
- field keyword, 495–496
- fields, 248, 479
- file input/output (I/O)
- asynchronous, 527, 528
- binary, 528, 539–540
- general discussion, 525–526
- readers, 527, 539–540
- streams
- example, 529–533
- other streams, 541
- overview, 526
using
statement, 534–537
- writing to files, 527–529, 540
- file permissions, 500, 508. See also access control
- File Transfer Protocol (FTP), 544, 551–553
- FileInfo class, 158
- FileInfo objects, 158–159
- FileRead program
- file-scoped namespaces, 456
- FileStream class
- asynchronous/synchronous I/O, 527, 528
- example, 529–533
- general discussion, 525–526, 541
- other, 541
- reading file, 537–540
using
statement, 534–537
- writing to file, 527–529, 540
- FileWeb class, 548
- FileWrite program
- finally blocks, 210–211, 212–213
- Find() function, 171
- FindEmpty() function, 171
- firewalls, 555
- fixed-length variable types, 29, 39
- fixed-value arrays, 127, 128
- flat-file format. See serialization
- flexible dependencies, 403–404
- flexible lists, 125
- float numeric constants, 43
- float variable type, 31–34, 234
- floating-point numbers, 86–87
- floating-point variables
- calculation speed, 33–34
- counting number conversion, 44–45
- declaring, 31–32
- limitations, 32–34
- flow control
else
statement, 100–102
- general discussion, 95–96
if
statements
- nesting, 102–104
- overview, 96–97
- sample program, 97–100
- loops
break
statement, 115–116
continue
statement, 115–116
decimal
variable type limitations, 35
do…while
statement, 114–115
- flexibility, 116–120
- nesting, 123–124
- overview, 110–111
- scope, 120
for
statement, 120–122
while
statement, 111–114
switch
statement
- capitalization, 56–58
- overview, 104–106
- restrictions, 106–107
switch
expression, 107–110
- font information, 37
- for loop statements, 120–122
- for(;;) statement, 54, 122
- foreach loop method
- in arrays, 133–136
- collection classes, 164–168
DescendingEvens()
method, 181–183
- general discussion, 58, 71–72, 122
IEnumerable<T>
interface, 166, 167–168, 391
LoopThroughFiles
program, 165, 167–168
- form class, 418
- format specifiers, 236
- format string, 73
- Fortran programming language, 127, 402–403
- fourth-generation programming languages, 205
- FoxPro programming language, 509
- fractions, 30–31
- free text symbol, 19. See also comments
- FTP (File Transfer Protocol), 544, 551–553
- FtpWeb class, 548
- fully qualified namespaces, 458–459
- Func keyword, 413–415
- function pointers, 409, 411, 413–415
- functional programming coding, 577
- Functional Programming For Dummies (Mueller), 109
- functions
- anonymous, 109, 421–424, 585–586
- local
- attributes, 301–302
- creating basic, 300–301
- instance methods, 300–302
- refactoring process, 287
- static methods, 261, 271–273
G
- game design project
- board creation, 570–572
- event handlers, 569–570
- first steps, 565–566
- general discussion, 565
- new game start method, 574
- project setup, 567
- score handling, 567–569
- score printing, 572–573
- Gamma, Erich, 425, 707
- garbage collection, 330, 350–351, 477
- general-purpose registers, 33–34
- generic collection classes
- boxing/unboxing, 188, 189
- general discussion, 142, 187–188
PriorityQueue
wrapper class
ColorsPriorityQueue
example, 193
- constraint options, 202–204
Count()
method, 200–201
Dequeue()
method, 199–200
- easy way to write, 197–198
Enqueue()
method, 199
Main()
method, 196–197
- overview, 190–192, 198
PackageFactory
class, 201–205
TopQueue()
method, 200
- unwrapping, 194–195
- type-safety, 188–189
- variance, 205–208
- generic delegates, 187–189, 409–410
- generic interfaces, 187–189
- generic iterators, 184
- generic methods, 187–189
- get() accessor, 183–185
- GetCurrentDirectory() method, 157–158
- GetEnumerator() method, 134–135, 165–166
- GetFileList() method, 158, 160
- GetNameValue() method, 238–239
- getter methods, 308–309, 314
- Git software, 593
- global namespaces, 454
- global using statements, 435–436
- Globally Unique ID (GUID), 622
- Google Colaboratory (Colab), 578
- Graphic Development Environment, 604. See also designer
- graphical user interface (GUI), 7, 10
- Graphics class
- brushes, 563
- general discussion, 561–562
- pens, 562
- text, 563
- greater than operator, 81, 89
- greater than or equal to operator, 85
- Groovy programming language, 577
- gRPC, 753–754
- GUI (graphical user interface), 7, 10
- GUID (Globally Unique ID), 622
H
- hackers, 500, 555
- Halo Infinite, 562, 563
- hard-coding, 104
- HAS_A relationship
- general discussion, 188
- inheritance, 345, 346
- HAS_A relationships
- interfaces for managing changes, 403–404, 405–406
- wrapping, 531–532
- HashSet<T> collection class
Add()
method, 150
AddRange()
method, 151–152
- creating, 150
ExceptWith()
method, 153
- general discussion, 142, 149, 150
IntersectWith()
method, 152–153
SymmetricExceptWith()
method, 152–153
- hashtables, 512
- heap memory
- anonymous methods and, 422–424
- garbage collection, 330, 350–351
- objects, 249
- reference structures and, 487–488
- Hebrew alphabet, 36–37, 529
- Helm, Richard, 425, 707
- Help Index, 51–52, 84, 87
- hex dump, 156
- hexadecimal base
- ASCII table, 162
- bit values and, 235–236
- general discussion, 30, 43, 156
LoopThroughFiles
program
- files list creation, 159–160
- formatting output lines, 160–161
- hexadecimal output, 161–163
- overview, 156–159
- Visual Studio 2022, 163–164
- Unicode character set, 163
- high-level computer languages, 8
- Hindi alphabet, 529
- Hololens, 721, 725
- HTML, 724
- HTTP (HyperText Transfer Protocol) applications
- ASP.NET Core applications, 746–747
- downloading files via, 551–553
- general discussion, 604
System.Net.Http
namespace, 546
- tags, 745
- XAML and, 643
- Http (HyperText Transfer Protocol) class, 546, 548
- HTTPS-enabled sites, 749–750
- HttpWebRequest class, 545
- human languages, 8, 36–37, 529
I
- ICollection<T> interface type, 390
- ICommand interface, 709–710
- IComparable interface type, 390–391
- IComparable<T> interface type, 390–391, 392–394
- IDictionary<TKey, TValue> interface type, 390
- IDisposable interface type, 390
- IEnumerable interface type, 390
- IEnumerable<T> interface type, 166, 167–168, 391
- IEnumerator interface, 134, 165–168
- IEnumerator<T> interface, 166–168, 391
- if statements
- general discussion, 20, 96–97
- indenting, 100
- nesting, 102–104
- sample program, 97–100
- if.else expression, 101
- IFormattable interface type, 390
- IIS Express icon, 785–786
- IL (Intermediate Language), 411, 438
- IList<T> interface type, 390
- images
- cribbage board project
- board creation, 570–572
- event handlers, 569–570
- first steps, 565–566
- new game start method, 574
- overview, 565
- project setup, 567
- score handling, 567–569
- score printing, 572–573
- general discussion, 559–561
Graphics
class
- immutable properties, 309
- imperative coding, 577
- implicit type conversions, 44, 90–91
- IMyInterface constraint, 204
- increment operators, 84–85, 122
- indexers
- collection classes, 169–173
- format, 169
- general discussion, 127, 129
- sample program, 170–173
struct
keyword, 483–484
- syntax, 141
- IndexOf() methods, 59
- IndexOfAny() method, 59, 70–71
- infinite loops, 114, 122
- information disclosure, 502–503
- inheritance
- abstraction
- abstract classes, 374–377
- factoring, 369, 371–374
- inheritances of convenience, 371
- overview, 368
- UML, 370
BankAccount
class example
- basic update, 336–338
Console.WriteLine()
method tracking, 339–342
- overview, 335
CAN_BE_USED_AS
relationship, 379–381
- chaining, 336–338
- containment versus, 343–345
- destructors, 330, 350–351
- general discussion, 168, 244–245, 333–334, 353
HAS_A
relationship, 345, 346
- interface, 387, 401–402
IS_A
relationship
- nonreflexive nature, 347
- overview, 342–345, 346
- transitive nature, 335
- method overloading
- hiding base class method, 355–361
- overview, 276–278, 354–355
- other features
- avoiding
as
operator invalid conversions, 349–350
- avoiding invalid runtime casts, 347–348
- avoiding
is
operator invalid conversions, 348–349
- substitutable classes, 346–347
- polymorphism
- declaring method virtual, 365–368
is
operator for accessing hidden methods, 364–365
- overview, 361–364
- purpose, 334–335
- tracking features, 339–342
- inheritance methods
- general discussion, 354–355
- hiding base class method, 355–361
- polymorphism
- declaring method virtual, 365–368
is
operator for accessing hidden methods, 364–365
- overview, 361–364
- inheritances of convenience, 371
- init accessor, 487
- init-only setters, 309–310
- input/output
- asynchronous, 527, 528
- general discussion, 525–526
- readers, 527, 539–540
- streams
- example, 529–533
- other streams, 541
- overview, 526
using
statement, 534–537
- writing to files, 527–529, 540
- Insert() method, 79
- instance fields, 262–263
- instance members, 258
- instance methods
- accessing current object, 298–300
- effective use, 293–295
- general discussion, 262–263, 287
- local functions, 300–302
- objects
- accessing current object, 296–300
- passing to method, 288–290
- static methods compared with, 290–296
- instance properties
- effective use, 293–295
- general discussion, 290
- int numeric constants, 43
- int variable
- creating list for, 144
- declaring, 28
- different types, 28–30
- enumeration data type, 234
- general discussion, 27
- intrinsic variable types, 39
- Int32.TryParse(s, n) method, 64
- integer literal, 30
- integers, 27, 30–31, 33–34. See also specific integers
- Integrated Development Environment (IDE). See also Visual Studio 2022 software
- general discussion, 589–590, 591, 603
- Jupyter Notebook software, 4, 23–24, 591
- mobile devices, 7
- Intel processors, 33–34
- IntelliSense feature, 223–224, 592, 618–619, 630
- IntelliTest feature, 595
- intentional programming, 265
- interface keyword, 381
- interfaces
CAN_BE_USED_AS
- example program, 391–396
- inheritance, 379–381
- elements, 381–382
- general discussion, 333, 379
- hiding methods behind, 399–401
- inheritance, 401–402
- for managing changes
- abstract classes, 404–405
- flexible dependencies, 403–404
HAS_A
relationships, 403–404, 405–406
- overview, 402–403
- as method parameter
- example, 387–388
- mixing with inheritance, 387
- naming conventions, 386
- newer C# 8.0 additions, 383–386
- overview, 382–383
- purpose, 386
- other uses
- array/collection base type, 389–390
- general object reference type, 390
- method return type, 389
- overview, 388
- polymorphism, 401–402
- predefined, 390–391
- for unifying classes, 396–399
- Intermediate Language (IL), 411, 438
- internal access modifier
- Internet
- C# programming language and, 9
- RFCs, 544
System.Net
namespace
- checking network status, 549–551
- downloading files, 544, 551–553
- email, 544, 546, 553–556
- important subordinate namespaces, 545–547
- logging network activity, 556–558
- overview, 543–545
- protocol nomenclature, 548
- Internet of Things (IoT), 598, 725
- Internet Protocol (
IP
) class, 548
- interpolated constants, 44
- interpolated strings, 44, 77, 391–392
- intersection operation, 149, 152–153
- IntersectWith() method, 152–153
- intrinsic variable types, 39–40
- invariance, 205
- I/O. See input/output
- iOS platform, 590, 593, 725
- IoT (Internet of Things), 598, 725
- IP (Internet Protocol) class, 548
- IPrioritizable interface, 195
- IronPython programming language, 585
- IronRuby programming language, 583, 585
- is operator
- accessing hidden methods, 364–365
- general discussion, 189
- invalid conversions, 348–349
- IS_A Object, 188
- IS_A relationship
- inheritance, 342–345, 346
- nonreflexive nature, 347
- transitive nature, 335
- IsAllDigits() method, 63–66
- item templates, 635–637
- Item.GetType() method, 234
- Item.GetTypeCode() method, 234
- iterator blocks
- example, 176–177
- general discussion, 173–175
- other forms
- class properties, 180, 183–185
- named iterators, 180, 181–183
- overview, 180
- special-purpose streams, 183
- reference structures and, 488
yield break
statement, 178, 179–180
yield return
statement, 178–179
- iterators
- advantages, 165–167
- arrays, 134–136
- CLR limitations, 234
- defining switches, 230, 237–238
enum
keyword, 231–232, 234
- flags, 229, 235–236
- general discussion, 108, 155, 195, 229–230
- generic, 184
- initializers, 229, 233
- interfaces, 134–135, 165–168
LoopThroughFiles
program, 159–164
- methods extension, 238–239
- named, 180, 181–183
- real-world examples, 231–232
- specifying data type, 234–235
J
- Japanese language, 529
- JavaScript Object Notation (JSON), 777–778
- JavaScript programming language, 577, 724
- JavaScript scripting language, 46, 575
- Johnson, Ralph, 425, 707
- Join() method, 66
- JSON (JavaScript Object Notation), 777–778
- jumps
break
statements, 115–116, 123–124
continue
statement, 115–116
Dequeue()
method, 199–200
do…while
statement, 114–115
Enqueue()
method, 199
finally
blocks, 212–213
- flexibility, 116–120
- general discussion, 96, 110–111
- nesting loops, 123–124
- parts to, 122
- scope, 120
for(;;)
statement, 54
for
statement, 120–122
TopQueue()
method, 200
while
statement, 111–114
while(true)
statement, 54
- Jupyter Notebook software, 4, 23–24, 591
K
- KeyedArray virtual array class, 170–173
- keys, 145
- Knuth, Donald, 23, 591
- Korean language, 529
L
- lambda expressions
- anonymous methods and, 422–424
Colors.ForEach()
method, 165
- discard parameters, 423
- dynamic programming, 585–586
- general discussion, 109, 421, 430
- lambda operator, 109
- reference structures, 488
- Language Integrated Query (LInQ), 23, 134, 510
- LastIndexOf() method, 59
- LastIndexOfAny() method, 59
- late binding, 362–364. See also polymorphism
- leap years, 41
- LeBlanc, David C., 555
- less than operator, 81
- less than or equal to operator, 85
- libraries, 433, 599. See also class libraries
- like-typed variables, 243
- LinkedList<T> collection class
- general discussion, 142, 166–167
MoveNext()
method, 142, 166–167
- LInQ (Language Integrated Query), 23, 134, 510
- Linux operating systems
- general discussion, 1, 10
- market share, 721
- MonoDevelop application, 590
- .NET Core, 13
- path separator, 534
- Visual Studio 2022, 590
- LISP (List Processing) language, 576
- list collections
- converting to arrays, 144
- general discussion, 125, 126, 143
- instantiating for
int
, 144
- instantiating for
string
, 143–144
- other tasks, 145
- searching, 144–145
- list keyword, return values alternatives
- output parameters, 471–472
- overview, 470–471
- values by reference, 472–473
- List Processing (LISP) language, 576
- List<T> collection class, 142, 187
- listeners. See Observer design pattern
- literate programming technique, 23, 591
- Live Unit Testing feature, 595
- living organisms classification, 230
- local data stores, 776
- local functions
- attributes, 301–302
- creating basic, 300–301
- instance methods, 300–302
- refactoring process, 287
- static methods, 261, 271–273
- logging network activity, 556–558
- logical and operator, 87–88
- logical comparison operators, 85–88
- logical numeric constants, 43
- logical or operator, 87–88
- logical variable types, 36, 85–88
- long int numeric constants, 43
- long integer type, 27–28, 43, 234, 243
- loops
break
statements, 115–116, 123–124
continue
statement, 115–116
do…while
statement, 114–115
- flexibility, 116–120
- general discussion, 110–111
- nesting, 123–124
- parts to, 122
- Razor runtime compilation, 772–774
- scope, 120
for(;;)
statement, 54
for
statement, 120–122
while
statement, 111–114
while(true)
statement, 54
- LoopThroughFiles program
- files list creation, 159–160
- formatting output lines, 160–161
- general discussion, 156–159
- hexadecimal output, 161–163
- Visual Studio 2022, 163–164
- lowercase string, 56–58
- low-level programming, 29, 411
- Lua programming language, 577
M
- machine language, 8, 599
- machine rot, 723, 724
- macOS platform
- general discussion, 1, 10
- market share, 721
- .NET Core, 13
- UWP, 725
- Visual Studio, 590, 591
- macro languages, 578
- Main() method
- class library projects, 439
- general discussion, 19, 157–158
get()
accessor, 183–185
- indexer testing, 172–173
- iterator block testing, 174–175
- last-chance exception-handling, 223, 225
PackageFactory
, 192
PriorityQueue
wrapper class, 196–197
- Mason, Nick, 126
- mathematics
- algorithm, 41
- counting numbers, 27, 33, 44–45
- fractions, 30–31
- hexadecimal base, 30, 43, 146
- integer truncation, 30–31
- logarithms, 26
- negative whole numbers, 27
- real numbers, 31–35
- rounding, 31, 86–87
- variables in, 25
- whole numbers, 27–28
- members
- class
internal
access modifier, 307
- overview, 257–258
private
access modifier, 304–306
protected
access modifier, 307, 434
protected internal
access modifier, 307, 434
public
access modifier, 247–249, 306
- data
const
data, 259
- initialization techniques, 299–300
readonly
, 259
- static properties, 257–258
- expression-bodied, 329–331
- instance, 258
- nonstatic, 258
- static members
- methods, 262–263
- overview, 258
readonly
data members, 259
- memory
- heap memory
- anonymous functions, 422–424
- garbage collection, 330, 350–351
- objects, 249
- reference structures and, 487–488
- program footprint, 51
- sets, 149
- stack memory, 39, 125, 249, 487–488
- variables, 26, 29, 32–33, 39, 249
- MemoryStream, 527, 541
- metadata, 437
- method calls. See specific method calls
- method overloading
- general discussion, 276–278, 354–355
- hiding base class method, 355–361
- polymorphism
- declaring method virtual, 365–368
is
operator for accessing hidden methods, 364–365
- overview, 361–364
- method parameter, 382–388
- method return type, 389
- methods. See also specific methods
- defining, 262–263
- general discussion, 99, 261, 433
- interfaces for hiding, 399–401
- partial, 433, 463–464
- partial methods
- MFA (Multi-Factor Authentication), 499–500
- Microsoft Access, 515
- Microsoft Azure development, 593, 597
- Microsoft Developer Network (MSDN) subscription, 595–596
- Microsoft Fakes feature, 595
- Microsoft Office 365, 593, 599
- Microsoft Word, 575–580
- MIME (Multipurpose Internet Mail Exchange), 546, 553–556
- minus symbol, 16
- mobile devices, 7, 599
- Model-View-Controller (MVC) paradigm, 751–752, 762–763
- Model-View-View Model (MVVM) pattern, 707, 723
- modulo operator, 82, 161
- MonoDevelop software, 590
- MoveNext() method, 166
- MSDN (Microsoft Developer Network) subscription, 595–596
- Mueller, John Paul, 109, 725
- multidimensional arrays, 134
- Multi-Factor Authentication (MFA), 499–500
- multiple inheritance, 387
- multiple simultaneous user environments, 596–597
- multiplication operator, 82
- Multipurpose Internet Mail Exchange (MIME), 546, 553–556
- mutually exclusive conditions, 100–102
- MVC (Model-View-Controller) paradigm, 751–752, 762–763
- MVVM (Model-View-View Model) pattern, 707, 723
- MyBaseClass constraint, 204
N
- named iterators, 180, 181–183
- named parameters, 470
- namespaces
- classes
- overview, 453–458
- partial classes, 433, 459–463
- partial methods, 433, 463–464
- fully qualified, 458–459
- partial classes, 433, 459–463
- partial methods
System.Security
namespaces, 506, 508
- using fully qualified, 458–459
- naming conventions, 259, 264, 387
- native integer types, 29
- negative whole numbers, 27
- nested
if
statements, 102–104
- nested loops, 123–124
- nested namespaces, 455
- .NET 5.0 framework
- OpenAPI support, 752–753
record
type, 491–496
- .NET 6.0 framework
- covariant return type, 319–320
FileStream
class performance, 526
init-only
setters, 310–311
- .NET Core applications, 560–561
- OpenAPI support, 752–753
PriorityQueue
wrapper class, 193–194
- updates, 592
- .NET Core
- console applications, 598
- cross-platform capabilities, 13
- general discussion, 10
System.Drawing
namespace and, 560–561
- UWP applications, 740–742
- Visual Studio Community edition software, 593
- .NET Core 3.x, 128, 748
- .NET Core 5.0, 748
- .NET ecosystem, 9–10, 13
- .NET Framework. See also collection classes
- asynchronous/synchronous I/O, 527, 528
- console applications, 598
- example, 529–533
- general discussion, 10, 525–526, 541
- other, 541
- predefined exceptions, 215–216
- predefined interface types, 390–391
- reading file, 537–540
- security
- decomposing components, 502
- deployment security, 507–508
- documentation, 501–502
- encryption, 507
- identifying potential, 502–503
- overview, 499–500
- Role-Based Security, 501
System.Security
namespaces, 506, 508
- what to protect, 500–501
- Windows applications, 503–508
- Windows login authentication, 503–506
System.Data
namespaces
- connecting to data source, 514–519
- creating access application, 514
- data containers, 509, 512
- getting to data, 512–513
- overview, 509–512
- RAD data tools, 519–521
- sample database setup, 513–514
- writing data code, 521–524
System.Drawing
namespace, 564–565
System.Net
namespace
- checking network status, 549–551
- downloading files, 551–553
- email, 544, 546, 553–556
- logging network activity, 556–558
- overview, 543–545
- protocol nomenclature, 548
- subordinate namespaces, 545–547
using
statement, 534–537
- writing to file, 527–529, 540
- network management scripting, 576
- network status, 549–551
- NetworkCredential class, 548
- NetworkStream class, 541
- new() constraint, 204
- new line constant, 37
- NewEditionEventHandler delegate type, 426
- Newspeak programming language, 577
- nint integer type, 29
- no return value methods, 281–282
- Node.js environment, 593
- nondestructive mutation, 494–495
- nondeterministic destruction
- garbage collection, 350–351
- general discussion, 330
- nonetype, 281–282
- nongenerics, 188–189
- non-Roman alphabets, 529
- nonstatic members, 258
- nonvoid methods, 281
- not equal to operator, 52, 86
- not operator, 58, 87
- notational C# programming language, 53
- Now property, 42
- NuGet Package Manager
- general discussion, 611, 622
- IronPython and IronRuby programming language, 585
- Visual Studio 2022, 600, 622, 631
- nuint integer type, 29
- null character type, 37, 38
- null coalescing operator technique, 226–227
- null object, 254
- null parameters, 473–474
- null
string
, 38, 60, 204–205
- nullable reference types, 469
- numeric constants, 43–44
- numeric string formatting, 391–392
O
- obfuscation, 499
- Object Linking and Embedding Database (OLEDB) protocol, 515
- Object Oriented Programming
- concepts, 246–247
- main principles
- object properties, 257–258
- object-based code, 250–253
- object-based languages, 363
- object-oriented coding, 577
- objects
- access control, 245, 326–329
- accessing current, 296–300
- classes
- accessing members, 249
- C# 9.0 code, 252–253
- class definition, 247–249
- discriminating, 253
- instantiating, 246
- passing to instance methods, 288–290
- properties, 257–258
- reference types, 254–255
- traditional code, 250–252
- general discussion, 126
- reference types, 254–255
- swapping reference, 136–139
- traditional code, 250–252
- Observer design pattern
- advertising, 426
- events, 425
- handler method, 430–431
- overview, 425–426
- raising events, 427–429
- subscribing, 427
- ODBC (Open Database Connectivity) compliance, 515
- OdbcAdapter class, 511
- OdbcCommand class, 511
- Office 365 software, 593, 599
- OLEDB (Object Linking and Embedding Database) protocol, 515
- OleDbAdapter class, 511
- OleDbCommand class, 511
- one-based arrays, 127
- OneCompiler software, 23
- OneTime binding mode, 683
- OneWay binding mode, 683
- OneWayToSource binding mode, 683
- OnlineGBD application, 590
- OOP. See Object Oriented Programming
- open command, 527
- Open Database Connectivity (ODBC) compliance, 515
- OpenAPI support, 752–753
- operating order hierarchy, 82–83
- operating systems
- Visual Studio requirements, 596
- Windows 8, 9
- Windows 10
- overview, 1, 2, 4, 10
- path separator, 534
- progress bar, 408
- Visual Studio editions, 590, 593
- Windows Server Core, 596–597
- operator overloading, 92–93
- operators
- arithmetic operators
- assignment operator, 26, 84, 91
- increment operators, 84–85
- operating orders, 82–83
- overview, 81
- simple, 82
- expression types
- assigning types, 91
- calculating types, 89–91
- operator overloading, 92–93
- overview, 89
- general discussion, 81
- logical comparison operators
- compound logical operators, 87–88
- floating-point number comparisons, 86–87
- overview, 85–86
- order hierarchy, 82–83
struct
keyword, 484–485
- optional parameters
- avoiding optional reference types, 468–469
- general discussion, 465, 466
- using, 466–468
- optional reference types, 468–469
- or operator, 87, 235
- Oracle, 515
- OracleAdapter class, 511
- OracleCommand class, 511
- out parameters, 465, 471–472, 579–580
- OutOfMemoryException, 215–216
- output parameters, 465, 471–472
- OverflowException, 217
- override keyword, 295, 365–368
P
- PackageFactory class, 192, 201–205
- Pad() formatting method, 67–69
- PadLeft() formatting method, 67–69
- PadRight() formatting method, 67–69
- parameters
- default, 278–279
- discard, 423
e
, 427–429, 431
- general discussion, 207–208, 273–274, 465
- named, 470
- null, 473–474
- optional parameters
- avoiding optional reference types, 468–469
- overview, 465, 466
- using, 466–468
- return values
- output parameters, 471–472
- overview, 470–471
- values by reference, 472–473
- parent class, 244–245
- parentheses, 83
- partial classes
- partial methods
- passwords, 499–500, 507
- Path.DirectorySeparatorChar command, 534
- pattern matching, 60, 108–110
- Peer Name Resolution Protocol (PNRP), 547
- performance
- reference structures, 487–488
- structures
- common elements, 479–482
- defining, 478–479
- limitations, 476
- overview, 476–477
- read-only structures, 485–487
- as records, 489–491
- reference structures, 487–488
- supplemental elements, 482–485
- value type, 477
- when to use, 477–478
- Perl programming language, 576
- Permissions namespace, 508
- persistence, 528
- PHP programming language, 577
- plus operator
- general discussion, 38, 81, 82
- operator overloading, 92–93
struct
keyword, 484–485
- plus symbol, 16
- PNRP (Peer Name Resolution Protocol), 547
- Policy namespace, 508
- polymorphism
- classes, 244–245
- general discussion, 189, 333
- interfaces and, 401–402
- method overloading
- declaring method virtual, 365–368
is
operator for accessing hidden methods, 364–365
- overview, 361–364
- postfix increment operator, 84, 122
- PowerShell, 732
- predefined interface types, 390–391
- Predicate keyword, 413–415
- prefix increment operator, 84, 122
- Principal namespace, 508
- PrincipalPermission namespace class, 508
- Priority enum, 195
- PriorityQueue wrapper class
ColorsPriorityQueue
example, 193
Count()
method, 200–201
Dequeue()
method, 199–200
- easy way to write, 197–198
Enqueue()
method, 199
- general discussion, 190–192, 198
IPrioritizable
interface, 195, 202–203
Main()
method, 196–197
PackageFactory
class, 201–205
TopQueue()
method, 200
- unwrapping, 194–195
- private access modifier
- access control, 271–273
- assemblies, 451–452
- fields, 479
- general discussion, 245, 304–306
- scope, 288–290
- procedural coding, 261, 577
- processors
- ARM, 596–597
- general discussion, 39–40
- Intel, 33–34
- productivity
- named parameters, 470
- null parameters, 473–474
- optional parameters, 465–469
- output parameters, 465, 471–472
- return values, 470–473
- programmatic breaks. See classes; methods
- programmer-defined generics
- boxing/unboxing, 188, 189
- general discussion, 187
PriorityQueue
wrapper class
ColorsPriorityQueue
example, 193
Count()
method, 200–201
Dequeue()
method, 199–200
- easy way to write, 197–198
Enqueue()
method, 199
Main()
method, 196–197
- overview, 190–192, 198
PackageFactory
class, 201–205
TopQueue()
method, 200
- unwrapping, 194–195
- type-safety, 188–189
- variance, 205–208
- programming languages. See also specific programming languages
- capitalization in, 18
- general discussion, 1, 8–10
- high-level, 8
- low-level, 29, 411
- programs
- dividing into class libraries
- access control keywords, 448–453
- adding projects to existing solutions, 442–445
- code, 445–446
- overview, 437, 439
- projects, 439–440
- stand-alone, 440–442
- test applications, 446–447
- dividing into executable programs, 437, 438–439
- dividing into multiple source files, 434–436
- general discussion, 8
global using
statements, 435–436
- memory footprint, 51
- progress bar
- general discussion, 408
- sample app
- first steps, 416–418
- overview, 415–416
- setting properties, 418
- sample program
- delegate life cycle code, 419–420
- handler method, 418–419
- project files
- dividing, 433, 434–435
- general discussion, 13
global using
statements, 435–436
- project templates, 632–635
- properties
- class
- accessors with access levels, 316
- overview, 246, 313–315
- side effects, 315–316
- static properties, 315
- fields versus, 248
- static properties, 315
struct
keyword, 482
- property element, 647–648
- protected access modifier, 245, 307, 434, 479
- protected internal access modifier, 245, 307, 309, 434, 452–453
- protection. See access control; security
- pseudocode, 53
- public access modifier
- public method exceptions, 223
- Publish/Subscribe pattern, 425–431
- Python programming language
- general discussion, 577
- literate programming technique, 23
- tuples, 282
- Visual Studio Community edition software, 593
Q
- Queue<T> collection class, 142, 190–192
- quit statement, 53–55
R
- RAD (Rapid Application Development), 519–521
- Random class, 183
- Random() method, 192, 194
- random number generator, 192
- Rapid Application Development (RAD), 519–521
- Razor runtime compilation
- arrays, 772–773
- changing web page data, 768–770
- comparison to predecessors, 762–763
- file layout, 763–764, 766
- general discussion, 748, 761–762
- logical statements, 771–772
- loops, 772–774
- output options, 767–768
- syntax, 766–767
- variables, 770
- Web Forms templates, 764–765
- React.js template, 754
- Read, Evaluate, Print, and Loop (REPL) environments, 589, 591
- reader/writer classes, 527, 528, 535, 539–540
- ReadLine() method, 55, 62–64, 99
- readonly data members, 259
- readonly keyword, 485–487
- real numbers
- decimal, 34–35
- floating-point
- declaring, 31–32
- limitations, 32–34
- overview, 31
- record type
field
keyword, 495–496
- general discussion, 475–476
- mutation, 494–495
- positional declaration, 493–494
- structures compared with, 491–492
- using, 492–493
- Redux template, 597, 754
- ref keyword, 280
- refactoring, 264, 268–271, 287
- reference structures, 487–488
- reference types. See also specific reference types
- allocation, 477
- avoiding optional, 468–469
- general object, 390
- interfaces as base type of, 389–390
- null
string
, 204–205
- objects, 254–255
- processor, 39–40
- region directive, 16
- registry access, 724
- Remote Desktop, 730–731
- Remote iOS Simulator, 593
- Remote Procedure Call (RPC), 753–754
- Remove() method, 59, 79
- REPL (Read, Evaluate, Print, and Loop) environments, 589, 591
- Replace() method, 59, 69–71, 77, 79
- repudiation of action, 502–503
- Request for Comments (RFCs), 544
- Reset() method, 165–166
- REST (Representational State Transfer), 752, 763
- return by reference, 472–473
- return keyword, 470
- return statement, 124, 280
- return values, 470–473
- reusability principle, 334
- Rextester software, 590
- RFCs (Request for Comments), 544
- Role-Based Security
- documentation, 501–502
- identifying potential threats, 502–503
System.Security
namespaces, 506, 508
- what to protect, 500–501
- Windows applications, 503–508
- Roman alphabet, 36–37, 529
- rounding, 31, 86–87
- RoutedCommand class, 710–711
- RoutedUICommand class, 710–711
- RPC (Remote Procedure Call), 753–754
- Ruby programming language, 577, 578, 583
- runtime errors
- custom exceptions, 220
- general discussion, 188, 209
- invalid casts, 347–348
is
operator invalid conversions, 348–349
as
operator invalid conversions, 349–350
- strategy, 221, 222–225
- thrown exceptions
catch
blocks, 210–212
- example, 216–219
finally
blocks, 210–211, 212–213
- last-chance handling, 223, 225
- null coalescing operator technique, 226–227
- programmer-thrown exceptions, 215–216
- sequence of events, 213–215
try
blocks, 211
try…catch
statement, 76, 225
- runtime type, 362–363
S
- same as operator, 52, 86–87
- SAO (Software Architecture Overview) diagram, 501–502
- sbyte integer type, 29, 234
- Scala programming language, 591
- Schardt, James A., 370
- Scheme programming language, 576
- scope, 288–290, 645
- scripting languages, 46, 575.See also specific scripting languages
- SDLC (Software Development Life Cycle), 501
- sealed keyword, 377–378
- Secure Sockets Layer (SSL) security, 749–750, 781
- SecureString namespace class, 508
- security. See also access control; specific access modifiers
- accessor methods, 308–309
- assemblies, 448–453
- base class method, 355–361
- class
BankAccount
example, 304–306
- covariant return type, 319–320
- expression-bodied members, 329–331
init-only
setters, 309–310
internal
access modifier, 307
- overview, 303–304, 306–308
- properties, 313–316
protected
access modifier, 307, 434
protected internal
access modifier, 307, 434
public
access modifier, 247–249, 306
- sealing, 377–378
- target typing, 316–318
- constructors
- C#-provided, 321–322
- example, 324–325
- initializers, 326–327
- initializers without constructors, 327–329
- overview, 309, 320–321
- replacing default, 322–324
DoubleBankAccount
program example, 311–313
- general discussion, 9, 499–500
internal
access modifier, 288
- in namespaces, 456–458
private
access modifier, 288, 304–306, 451–452
- properties versus fields, 248
readonly
keyword, 485–487
- Role-Based Security, 501
- software design, 500–503
System.Security
namespaces, 506, 508
- UWP, 724
- via local functions, 271–273
- Windows applications, 503–508
- Security namespace, 508
- Security.Principal namespace class, 503–506, 508
- seed values, 192
- serialization
- common storage methods, 777–778
- general discussion, 528, 775
- need for, 776
WeatherForecast
project
- API functionality, 783–786
- companion files, 775
- creating project, 778–781
- overview, 775–776
- realistic output, 781–783
RetrieveWeatherForecast
project, 786–793
- serialized data, 777–778
- Server Explorer panel, 615–617
- server-based applications, 500
- Service class, 548
- SetName() method, 289–290
- sets, 149–153
- setter methods, 308–309, 314
- SharePoint, 599
- short integer type, 29, 234
- short-circuit evaluations, 87–88
- sideloading, 727–728
- signed integer type, 29
- simple arithmetic operators, 82
- Simple Mail Transfer Protocol (SMTP), 546, 553–556
- single quotation marks, 36, 40
- Site namespace class, 508
- Smalltalk programming language, 576
- SMTP (Simple Mail Transfer Protocol), 546, 553–556
- Snapshot Debugger feature, 595
- Socket class, 548
- Software Architecture Overview (SAO) diagram, 501–502
- software design principles
- decomposing components, 502
- documentation, 501–502
- identifying potential threats, 502–503
- what to protect, 500–501
- Software Development Life Cycle (SDLC), 501
- Solution Explorer panel
- Files, 612–613
- general discussion, 610–611
- Projects, 612
- Solutions, 611–612
- solutions, 14, 435, 438
- Sort() method, 136–139
- source generator, 460, 464
- space character, 37
- special characters, 37
- Split() formatting method, 64–66, 71–72
- spoofing identity, 502–503
- SQL. See Structured Query Language
- SQL Management Studio, 609–610
- SqlCommand class, 511
- SqlDataAdapter class, 511
- SqlDateTime class, 511
- SSL (Secure Sockets Layer) security, 749–750, 781
- stack memory, 39, 125, 249, 487–488
- Stack<T> collection class, 142
- StackOverflowException, 215–216
- Start Debugging command, 17
- Start Without Debugging command, 17
- static anonymous functions, 422–424
- static coding, 591. See also dynamic programming
- static fields, 262–263
- static keyword, 422–424, 585–586
- static languages, 575
- static members
const
data members, 259
- general discussion, 258
- methods and, 262–263
readonly
data members, 259
- static methods
- arguments
- default arguments, 278–279
- matching definitions, 276
- overloading, 276–278
- overview, 273
- passing multiple arguments, 274–275
- passing single argument, 273–274
- call-by-reference feature, 280–281
- defining methods, 262–263
- effective use, 291–293
- example
- analyzing problem, 264–265
- local function, 261, 271–273
- overview, 263–265
- planning, 264–265
- refactoring, 268–271
- standard coding methods, 265–268
- expanding full name, 295–296
- general discussion, 261, 262, 287
- instance methods compared with
- effective use of properties and methods, 291–295
- method name expansion, 295–296
- overview, 290
- local functions, 300–302
- no return value, 281–282
- nonvoid, 281
- objects, 296–300
- passing multiple arguments, 274–275
- passing single argument, 273–274
struct
keyword, 481
- tuples, 282–285
- using, 262–263
- void, 281
- static operations, 581
- static properties, 257–258, 291–293, 315
- Stored Procedures, 524
- StreamReader class, 527, 529, 537–539
- streams
- example, 529–533
- general discussion, 525–526
- other, 541
- reading file, 537–540
using
statement, 534–537
- writing to file, 527–529, 540
- StreamWriter class, 527, 529–533
- STRIDE acronym, 502–503
- "string" character constants, 43
- string class, 48
- string constants, 37–39, 51
- string interpolation, 44, 77, 391–392
- string type
- changing case, 56–58
- common operations, 51–52
- comparing, 52–56
- example, 243
- formatting
- interpolation method, 77, 391–392
String.Format()
method, 72–76
- general discussion, 48–49
- getting user input, 61–66
- immutability, 50–51
- instantiating list for, 143–144
- looping, 58
- null, 37, 38, 204–205
- output manual control, 67–72
- searching, 59–61
StringBuilder
class, 77–79
switch
statement, 56–58
- StringBuilder class, 77–79
- String.Concat() method, 55
- String.Empty value, 37, 38, 43
- String.Format() formatting method
- example, 74–76
- format specifiers, 73–74
- general discussion, 72–73
- string.IsNullOrEmpty() method, 60
- StringReader class, 527, 540
- String.Split() method, 64–66
- StringWriter class, 527, 540
- struct constraint, 203, 204
- struct keyword
- common elements, 479–482
- defining, 478–479
- general discussion, 475
- limits, 476
- return values alternatives, 470–473
- supplemental elements, 482–485
- when to use, 477–478
- structural breaks. See assemblies; libraries; namespaces
- Structured Query Language
Adapter
class, 515
ADO.NET
, 510–512
System.Data
namespaces
- connecting to data source, 514–519
- creating access application, 514
- data containers, 509–512
- getting to data, 512–513
- RAD data tools, 519–521
- sample database setup, 513–514
- writing data code, 521–524
- structures
- classes compared with, 475, 476–477
- creating
- common elements, 479–482
- defining, 478–479
- supplemental elements, 482–485
- limitations, 476
- read-only, 485–487
- as records, 489–491
- reference, 487–488
- similarity to partial classes, 460–463
- value type, 477
- when to use, 477–478
- subarrays, 127, 129
- subroutine, 261
- subscript operator, 169
- substitutable classes, 346–347
- Substring() method, 59, 67, 77
- subtraction operator, 81, 82
- Swagger Specification, 753
- switch statement
- enumerations, 230, 237–238
- general discussion, 56–58, 104–106
- restrictions, 106–107
switch
expression, 107–110
- typed conditional expressions, 102
- SymmetricExceptWith() method, 152–153
- synchronous input/output (I/O), 527, 528
- synchronous methods, 488
- syntax
- system absolute value method, 86–87
- System namespace, 390, 437
- System.Collections.Generic namespace, 142, 166–167, 168, 390
- System.Collections.IEnumerable interface, 181–183
- System.Data.Common namespace, 511
- System.Data.ODBC namespace, 511
- System.Data.OleDb namespace, 511
- System.Data.OracleClient namespace, 511
- System.Data.SqlClient namespace, 511
- System.Data.SqlTypes namespace, 511
- System.Drawing namespace
- cribbage board project
- board creation, 570–572
- event handlers, 569–570
- first steps, 565–566
- new game start method, 574
- overview, 565
- project setup, 567
- score handling, 567–569
- score printing, 572–573
- general discussion, 559–561
Graphics
class
- .NET Core and, 560–561
- .NET Framework, 564–565
- System.Drawing.Common namespace, 560–561
- System.Environment.FailFast() method, 222
- System.EventArgs class, 427–429, 431
- System.Exception warning, 220
- System.IndexOutOfRangeException warning, 129
- System.IO namespace, 527, 528
- System.Linq keyword, 487
- System.Math class, 87
- System.Net namespace
- checking network status, 549–551
- downloading files, 551–553
- emailing status reports, 544, 546, 553–556
- general discussion, 543–545
- logging network activity, 556–558
- protocol nomenclature, 548
- subordinate namespaces, 545–547
- System.Net.Cache namespace, 545
- System.Net.Configuration namespace, 545
- System.Net.Http namespace, 546
- System.Net.Http.Headers namespace, 546
- System.Net.Mail namespace, 546
- System.Net.Mime namespace, 546
- System.Net.NetworkInformation namespace, 546, 549–551
- System.Net.PeerToPeer namespace, 547
- System.Net.PeerToPeer.Collaboration namespace, 547
- System.Net.Security namespace, 547
- System.Net.Sockets namespace, 547
- System.Net.WebSockets namespace, 547
- System.Object, 488
- System.Security namespaces, 506, 508
- System.ValueType, 488
- System.Web namespaces, 510
- System.Windows namespaces, 510
- Tab character, 20, 37, 592
- tampering with data or files, 502–503
- target typing, 316–318
- Task method, 488
- Task<TResult> method, 488
- taxonomies
- class factoring, 369, 371–374
- general discussion, 335, 377–378
- team development, 464
- templates. See specific templates
- terminator statement, 55, 114
- ternary operators, 101
- text-file input/output (I/O)
- asynchronous, 527, 528
- binary, 528, 539–540
- general discussion, 525–526
- readers, 527, 539–540
- streams
- example, 529–533
- other streams, 541
- overview, 526
using
statement, 534–537
- writing to files, 527–529, 540
- TextReader class, 527
- TextWriter class, 527
- 32-bit applications, 591
- 32-bit integers, 29
- 32-bit platforms, 596–597, 611
- this keyword
- accessing current object, 298–300
- array elements and, 483
- chaining, 336–338
- general discussion, 287
- thread safety, 486
- threat modeling, 500–503
- thrown exceptions
catch
blocks, 210–212
- example, 216–219
finally
blocks, 210–211, 212–213
- last-chance handling, 223, 225
- null coalescing operator technique, 226–227
- programmer-thrown exceptions, 215–216
- sequence of events, 213–215
throw
blocks, 210–211, 215
try
blocks, 210–211
- thumbprint scans, 499–500
- tight coupling, 202
- tilde symbol, 330, 350–351
- Time Travel Debugging feature, 595
- TimeSpan property, 42
- Tiobe Index, 1
- ToBoolean() method, 62
- ToDecimal() method, 99
- ToDouble() method, 62
- ToFloat() method, 62
- ToLower() method, 57
- Toolbox window, 21–22
- top-level statements, 20–21
- TopQueue() method, 200
- ToString() method, 78, 295, 308
- ToUpper() method, 51, 57
- Trim() formatting method, 62, 67–69
- TrimEnd() formatting method, 62, 67–69
- TrimFront() formatting method, 62, 67–69
- true numeric constants, 43
- true value, 36
- try…catch blocks
- factorial calculation example, 216–219
- general discussion, 76, 210, 225
- nesting, 213
- try blocks, 210–211
- try/finally block, 213
- tuples
Create()
method, 284
- general discussion, 282
- nesting, 284–285
Tuple
data type, 283–285
- using, 283
ValueTuple
data type, 284–285
- tvOS operating system, 725
- TwoWay binding mode, 683
- type conversion, 44–45, 90–91
- typed conditional expressions, 102
- type-safety, 187, 188–189
- typography, 559, 563
U
- UAP technology. See Universal Application Platform technology
- UIElements
- binding objects, 683–687
Canvas
, 662
- Command pattern
- built-in commands, 711–713
- custom commands, 713–717
ICommand
interface, 709–710
- overview, 707–708
- routed commands, 710–711, 717–718
DockPanel
, 661
- element binding, 693
- general discussion, 653–654, 655–656
Grid
- column sizing, 663–665
- column span, 665–666
- content alignment, 666
- horizontal alignment, 666
- margin versus padding, 666–667
- overview, 648–651, 662–663
- row sizing, 663–665
- row span, 665–666
- shared size group, 667–669
- simple data entry form, 669–672
- vertical alignment, 666
- relative values, 654
StackPanel
, 656, 658–659
- terminology, 654
- traditional event handling, 707–709
- Windows chrome themes, 657–658
WrapPanel
, 660–661
- uint integer type, 29, 234
- ulong integer type, 29, 234
- UML (Unified Modeling Language), 369, 370
- UML 2 For Dummies (Chonoles & Schardt), 370
- unary negative operator, 81, 82
- unboxing, 188, 189, 477–478
- underscore, 30, 259, 423
- Unicode character set, 163, 529
- Unicode Transformation Formats, 529
- Unified Modeling Language (UML), 369, 370
- uninitialized reference, 254
- union operation, 149, 151–152
- Unit Test Isolation feature, 595
- Unity Gaming Services, 559
- Universal Application Platform technology
- general discussion, 9
- Visual Studio Community edition, 593
- Universal Windows Platform applications
- Android OS, 590
- building
- adding background code, 738–739
- creating interface, 734–737
- defining project, 732–734
- test device, 739–740
- cross-platform support, 721–722, 725–726
- desktop applications, 598
- Developer Mode
- adding background code, 738–739
- choosing test device, 739–740
- creating interface, 734–737
- defining project, 732–734
- device settings, 728–729
- File Explorer settings, 730
- overview, 725–732
- PowerShell settings, 732
- Remote Desktop, 730–731
- sideloading, 727–728
- .NET Core applications, 740–742
- reasons to use, 722–724
- registry access, 724
- test application, 440
- Visual Studio 2022, 599, 604
- Visual Studio Community edition, 592
- Win32 API, 722–723
- WinRT, 604–607
- Xamarin platform, 725
- unlike-typed variables, 243, 246–247. See also classes
- UnmanagedMemoryStream class, 541
- unsigned int numeric constants, 43
- unsigned integer type, 29, 39
- Upload class, 548
- uppercase string, 56–58, 259
- Url namespace class, 508
- user-defined generics
- boxing/unboxing, 188, 189
- general discussion, 187
PriorityQueue
wrapper class
ColorsPriorityQueue
example, 193
Count()
method, 200–201
Dequeue()
method, 199–200
- easy way to write, 197–198
Enqueue()
method, 199
Main()
method, 196–197
- overview, 190–192, 198
PackageFactory
class, 201–205
TopQueue()
method, 200
- unwrapping, 194–195
- type-safety, 188–189
- variance, 205–208
- usernames, 499–500
- ushort integer type, 29, 234
- using directives, 14, 16, 19, 435–436
- using statement, 435–436, 534–537
- using System directive, 16
- UWP applications. See Universal Windows Platform applications
V
- Value property, 486–487
- values by reference, 472–473
- ValueTuple data type, 284–285
- value-type objects, 39–40, 188, 189, 477
- var keyword
- arrays, 139–140
- dynamic programming, 575, 580–582
- general discussion, 46–47
- initialization techniques, 148
- variable-length arrays, 129–132
- variables. See also specific variables
bool
- intrinsic variable types, 39
is
operator invalid conversions, 348–349
- logical comparison operators, 36, 85–88
as
operator invalid conversions, 349–350
- overview, 36
- character types, 36–37, 40–41
- counting, 114, 122
DateTime
, 41–42
decimal
, 34–35
- declaring, 26
double
, 32, 39, 43, 234, 243
- dynamic programming, 575, 580–582
- floating-point, 31–34, 44–45
- fraction, 30–31
- general discussion, 20, 25
int
- creating list for, 144
- declaring, 28
- different types, 28–30
- enumeration data type, 234
- intrinsic variable types, 39
- overview, 27
- like-typed, 243
- memory
- fixed-length variable types, 29, 39
- floating-point variable limitations, 32–33
- intrinsic variable types, 249
- overview, 26
- numeric constants, 43–44
- outside of exception handling blocks, 211
- Razor runtime compilation, 770
SqlDateTime
class, 511
- type conversion, 44–45
- unlike-typed, 243, 246–247
- value types, 39–40
- variance, 205–208
- Variant data types, 46
- VBScript scripting language, 46, 576
- vector drawings, 559. See also
Graphics
class
- verbatim string operator, 39
- View Source, 576
- ViewModel. See Model-View-View Model (MVVM) pattern
- virtual keyword, 365–368, 479
- virtual machine environments, 596–597
- Visual Basic programming language
- business applications, 509
- general discussion, 9, 10, 363, 576
- visual designer. See designer
- Visual Studio 2022 software. See also Developer Mode
- Android operating system, 590
- Application Wizard, 11
- autoindenting settings, 100
- best practices
'
'
character, 252
- anticipating problems, 209
- avoiding
!=
comparison operator, 52
- avoiding
==
comparison operator, 52
- braces, 19, 97
- comments, 19, 247, 264
- defining important constants, 104
- double-clicking error entries, 276
- elegance as a goal, 345
EventHandler
delegate type, 426
- exception-handling strategy, 221–225
- explaining user errors, 120
- form class use, 418
- indentation, 100
- last-chance exception-handling, 223, 225
- local functions, 301
- method argument values, 275
- methods naming conventions, 264
- .NET Framework predefined exceptions, 215–216
- no more than necessary access, 308
- nulling invalid references, 533
- object variable references, 255
- object-initializer syntax, 329
- plain-English error displays, 225
- properties versus fields, 248
- protecting casts, 348–350
- short and specific
try
blocks, 211
- spare use of
virtual
keyword, 368
- specific
catch
blocks, 212
ToString()
method, 295
- variable names, 247
- viewing warnings as errors, 360
Write()
method, 252
- Breakpoints window, 620–621
- Build menu, 623
- Class View panel, 617
- Code Editor, 618–619
- Code Style settings, 631
- command prompt, 7, 18, 589, 622
- common operations, 51–52
- common uses, 509
- custom templates, 632–637
- debugger
- commands, 17
- inheritance tracking, 334, 339–342
- as learning aid, 623–626
- overview, 592
- Snapshot Debugger feature, 595
- Time Travel Debugging feature, 595
- designer
- Data View feature, 609–610
- overview, 603–604
- UWP application, 604–607
- WinForms application, 609
- WPF application, 607–609
- EnvironmentInternational Settings page, 630
- Fonts and Colors settings, 629
- general discussion, 4, 10, 589–590, 603
- Immediate window, 620
- installation requirements, 596–597
- IntelliSense feature, 223–224, 592, 618–619, 630
- keyboard commands, 629–630
LoopThroughFiles
program
- files list creation, 159–160
- formatting output lines, 160–161
- hexadecimal output, 161–163
- overview, 156–159
- Visual Studio 2022, 163–164
- MSDN subscription, 595–596
- .NET ecosystem and, 13
- new application creation
- default program location, 15–16
- executing, 17–18
- overview, 11
- reviewing, 18–20
- source program, 11–15
- testing, 16
- Toolbox window, 21–22
- top-level statements, 20–21
- NuGet Package Manager, 585, 600, 611, 622, 631
- Options menu, 627–631
- Peek Definition tooltip, 223
- programming languages options, 630–631
- project types, 597–602
- Properties panel, 613–614
- Refactor menu, 264
- Server Explorer panel, 615–617
- Solution Explorer panel, 610–613
System.Data
namespaces
- connecting to data source, 514–519
- creating access application, 514
- data containers, 509, 512
- getting to data, 512–513
- overview, 509–512
- RAD data tools, 519–521
- sample database setup, 513–514
- writing data code, 521–524
- Task List window, 621
- tips
- Application Wizard namespaces, 455
- IIS Express icon, 785–786
- implementing interfaces, 383
- Toolbox panel, 614–615
- Tools menu, 621–622
- updates, 590–592
- Visual Studio Solution Explorer, 435
- Web Forms templates, 764–765
- WPF applications
- application-scoped resource, 647–648
- building, 644–649
- login authentication, 503–506
- overview, 9, 604, 607–608, 641
- purpose, 642–643
- XAML, 605–607, 643–644, 650–651
- Visual Studio Community edition software
- general discussion, 4, 7, 590, 592–594
- installation requirements, 596–597
- Visual Studio Enterprise edition software, 594–595
- Visual Studio .NET, 10
- Visual Studio Professional edition software, 594
- Visual Studio Solution Explorer, 435
- Vlissides, John, 425, 707
- void keyword, 281–282
- void methods, 281
W
- W3Schools tutorials, 23
- warnings, 360. See also error-handling; runtime errors; specific warnings
- watchOS operating system, 725
- WDP (Windows Device Portal), 728–729
- WeatherForecast project
- API configuration and functionality, 783
- API functionality, 784–786
- companion files, 775
- creating project, 778–781
- general discussion, 775–776
- realistic output, 781–783
RetrieveWeatherForecast
project
- creating project, 786–787
- deserializing data, 789–792
- running application, 793
- serializing data, 789–792
- user interface, 787–789
- Web class, 548
- Web Forms templates, 764–765
- Web Sockets (WebSocket) functionality, 547
- web-based application programming interfaces (APIs)
- general discussion, 1, 599
System.Net
namespace
- checking network status, 549–551
- downloading files, 551–553
- email, 544, 546, 553–556
- logging network activity, 556–558
- overview, 543–545
- protocol nomenclature, 548
- subordinate namespaces, 545–547
- WebRequest class
- downloading files via, 551–553
System.Net
namespace, 545
- while loop statements
break
statement, 116–120
- general discussion, 111
- incrementing counting variable, 114, 122
- sample program, 111–114
- while(true) statement, 54
- white space, 62
- whole numbers, 27–28
- Win32 APIs (application programming interfaces), 215, 722–723
- Windows 8 operating system, 9
- Windows 10 operating system
- general discussion, 1, 2, 4, 10
- market share, 721
- path separator, 534
- progress bar, 408
- UWP, 721, 725
- Visual Studio 2022, 590, 593
- Windows 11 operating system, 721, 725
- Windows API, 411
- Windows applications, 503–508
- Windows chrome themes, 657–658
- Windows containers, 596–597
- Windows Desktop, 592
- Windows Device Portal (WDP), 728–729
- Windows Forms application
- encryption, 507
- general discussion, 9, 609
- login authentication, 503–506
- SAO diagram, 502
- window elements appearance, 657
- Windows login authentication, 503–506
- Windows Minimal Server, 596–597
- Windows Presentation Foundation applications. See also Universal Windows Platform applications
- building
- application-scoped resource, 647–648
- overview, 644–647
- running application, 648–649
Canvas
, 662
- Command pattern
- built-in commands, 711–713
- custom commands, 713–717
ICommand
interface, 709–710
- overview, 707–708
- routed commands, 710–711, 717–718
- Common Language Runtime (CLR)
- application-scoped resource, 647–648
- building, 644–649
- login authentication, 503–506
- overview, 9, 604, 607–608, 641
- purpose, 642–643
- XAML, 605–607, 643–644, 650–651
- data binding
- binding object, 683–687
- converting data, 697–704
- dependency properties, 682
- editing data, 687–693
- modes, 683
- other aspects, 705
- overview, 681
- validating data, 693–697
DockPanel
, 661
- general discussion, 9, 607–608, 641
Grid
- column sizing, 663–665
- column span, 665–666
- content alignment, 666
- horizontal alignment, 666
- margin versus padding, 666–667
- overview, 648–651, 662–663
- row sizing, 663–665
- row span, 665–666
- shared size group, 667–669
- simple data entry form, 669–672
- vertical alignment, 666
- layout controls
- overview, 653–654
- relative values, 654
- login authentication, 503–506
- Property system, 682
- purpose, 642–643
StackPanel
, 656, 658–659
- traditional event handling, 707–709
- Visual Studio 2022 software, 604
- Windows chrome themes, 657–658
WrapPanel
, 660–661
- XAML
- basic input controls, 674–676
- C# comparison, 650–651
- display-only controls, 672–674
- list-based controls, 677–679
- overview, 604, 605–607, 643–644
- Windows Runtime (WinRT), 575–576, 604–607
- Windows Server Core, 596–597
- Windows Sockets (Winsock) functionality, 547
- WindowsIdentity namespace class, 508
- WindowsPrincipal namespace class, 508
- WinForms application. See Windows Forms application
- WinUI, 724
- Word, 575–580
- World Wide Web, 576
- WPF applications. See Universal Windows Platform applications; Windows Presentation Foundation applications
- WrapPanel method, 660–661
- wrapper classes
HAS_A
relationships, 531–532
PriorityQueue
, 191–192, 194
StreamWriter
class, 531–532
- WriteLine() method, 99, 262–263
- Writing Secure Code (Howard & LeBlanc), 555
X
- Xamarin platform, 10, 593, 595, 725
- XAML
- C# versus, 650–651
- common controls
- basic input controls, 674–676
- display-only controls, 672–674
- list-based controls, 677–679
- data binding
- converting data, 697–704
- defining, 683–687
- dependency properties, 682
- editing data, 687–693
- modes, 683
- overview, 681
- validating data, 693–697
- Xbox One, 721, 725
- XML (Extensible Markup Language)
- documentation comments, 223–225
- files, 601
- general discussion, 777–778
- serialization, 775
- xor (exclusive or) operator, 87, 235
Y
- yield break statement, 178, 179–180
- yield return statement, 178–179
..................Content has been hidden....................
You can't read the all page of ebook, please click
here login for view all page.