C# 13 Programming Essentials – .NET. 9 Ed

C# 13 Programming Essentials – .NET. 9 Ed

C# 13 Programming Essentials – .NET. 9 Ed
Автор: Smyth Neil
Дата выхода: 2024
Издательство: Payload Media, Inc.
Количество страниц: 616
Размер файла: 1.9 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

C# 13 Programming Essentials - .NET 9 Edition....2

1. Start Here....25

1.1 Source code download....27

1.2 Feedback....28

1.3 Errata....29

1.4 Take the knowledge tests....30

2. The History of Programming Languages and C#....31

2.1 The history of programming languages....32

2.2 What exactly is C#?....34

2.3 Who is using C#?....35

2.4 Take the knowledge test....36

2.5 Summary....37

3. C# Infrastructure....38

3.1 The Common Language Infrastructure (CLI)....39

3.2 Common Intermediate Language (CIL)....40

3.3 Virtual Execution System (VES)....41

3.4 Common Type System (CTS) & Common Language Specification (CLS)....42

3.5 The Framework (Base Class and Framework Class Libraries)....43

3.6 Implementations of the CLI....44

3.7 Take the knowledge test....45

3.8 Summary....46

4. Installing Visual Studio Code, C# and .NET 9....47

4.1 Installing the .NET 9 SDK....48

4.1.1 Installing .NET 9 on Windows....49

4.1.2 Installing .NET 9 on macOS....50

4.1.3 Installing .NET 9 on Red Hat Linux-based distributions....51

4.1.4 Installing the .NET 9 on Debian/Ubuntu distributions....52

4.1.5 Installing .Net 9 from the Linux binaries....53

4.2 Downloading Visual Studio Code....55

4.3 Installing on Windows....56

4.4 Installing on macOS....57

4.5 Installing on Linux....58

4.5.1 Debian/Ubuntu....59

4.5.2 Red Hat-based distributions....60

4.6 Customizing Visual Studio Code....61

4.7 Adding the C# Dev Kit extension....62

4.8 Take the knowledge test....63

4.9 Summary....64

5. A Guided Tour of Visual Studio Code....65

5.1 Workspaces, projects, and solutions....66

5.2 The VS Code main window....67

5.3 The Command Palette....70

5.4 Splitting the editor window....71

5.5 Zen mode....72

5.6 Learning with the Editor Playground....73

5.7 Take the knowledge test....74

5.8 Summary....75

6. Creating an Example C# App in VS Code....76

6.1 Creating the SampleApp project....77

6.2 Reviewing the SampleApp project....79

6.3 Writing the app code....82

6.4 Top-level statements and the Main method....84

6.5 Take the knowledge test....86

6.6 Summary....87

7. C# Variables and Constants....88

7.1 What is a C# variable?....89

7.2 Type annotations and implicit typing....90

7.3 What is a C# constant?....92

7.4 Integer types....93

7.5 Floating-point Variables....96

7.6 Decimal type....98

7.7 Boolean type....99

7.8 Character data type....100

7.9 Special characters....102

7.10 String data type....104

7.11 Verbatim string literals....105

7.12 String interpolation....107

7.13 Type casting....110

7.13.1 Implicit casting....111

7.13.2 Explicit casting....113

7.13.3 Identifying variable’s type....115

7.14 Take the knowledge test....116

7.15 Summary....117

8. C# Operators and Expressions....118

8.1 What is an expression?....119

8.2 The basic assignment operator....120

8.3 C# arithmetic operators....121

8.4 C# operator precedence....123

8.5 Compound assignment operators....126

8.6 Increment and decrement operators....128

8.7 Comparison operators....130

8.8 Boolean logical operators....132

8.9 Range and index operators....135

8.10 The ternary operator....136

8.11 Null-coalescing operators....138

8.12 Bitwise Operators....140

8.12.1 Bitwise NOT....141

8.12.2 Bitwise AND....142

8.12.3 Bitwise OR....143

8.12.4 Bitwise XOR....144

8.12.5 Bitwise Left Shift....145

8.12.6 Bitwise Right Shift....146

8.13 Compound Bitwise Operators....147

8.14 Take the knowledge test....148

8.15 Summary....149

9. C# Conditional Control Flow....150

9.1 Looping vs. conditional control flow....151

9.2 Using the if statement....152

9.3 Using if … else … statements....154

9.4 Using if … else if … statements....156

9.5 Take the knowledge test....158

9.6 Summary....159

10. The C# switch Statement....160

10.1 Why use the switch statement?....161

10.2 Using the switch statement....163

10.3 A switch statement example....165

10.4 Explaining the example....167

10.5 Using switch expressions....168

10.6 Using goto in a C# switch statement....170

10.7 Using continue in a C# switch statement....172

10.8 Take the knowledge test....173

10.9 Summary....174

11. C# Looping with the for Statement....175

11.1 Why use loops?....176

11.2 C# loop variable scope....179

11.3 Creating an infinite for loop....180

11.4 Breaking out of a for loop....181

11.5 Nested for loops....183

11.6 Breaking from nested loops....184

11.7 Continuing for loops....185

11.8 The C# foreach statement....186

11.9 Take the knowledge test....188

11.10 Summary....189

12. C# Looping with do and while Statements....190

12.1 The C# while loop....191

12.2 C# do … while loops....193

12.3 Breaking from loops....194

12.4 The continue statement....195

12.5 Take the knowledge test....196

12.6 Summary....197

13. An Introduction to C# Object-Oriented Programming....198

13.1 What is an object?....199

13.2 What is a class?....200

13.3 Creating the ObjectDemo project....201

13.4 Declaring a C# class....203

13.5 Access modifiers....206

13.6 Creating C# class members....208

13.7 Fields vs. properties....209

13.8 Adding members to the BankAccount class....213

13.9 Static, read-only, and const data members....215

13.10 Instantiating an object from a C# class....216

13.11 Accessing C# object members....217

13.12 Adding methods to a C# class....219

13.13 C# constructors....223

13.14 C# primary constructors....227

13.15 C# finalizers....228

13.16 The “this” keyword....229

13.17 Take the knowledge test....232

13.18 Summary....233

14. C# Methods....234

14.1 What is a method?....235

14.2 Methods vs. functions....236

14.3 Parameter or argument?....237

14.4 How to declare a C# function....238

14.5 Creating the MethodDemo project....240

14.6 Declaring a C# class file....241

14.7 Calling a C# method....242

14.8 Handling return values....243

14.9 Passing arguments to a method....245

14.9.1 Named arguments....246

14.9.2 Optional arguments....247

14.10 Handling variable numbers of arguments....249

14.11 C# in, out, and ref parameter modifiers....251

14.12 Take the knowledge test....256

14.13 Summary....257

15. C# Delegates....258

15.1 What is a delegate?....259

15.2 Declaring a delegate....260

15.3 Using delegates....261

15.4 Creating the DelegateDemo project....262

15.5 A C# delegate example....263

15.6 Multicast delegates....266

15.7 Passing a delegate to a method....269

15.8 Take the knowledge test....272

15.9 Summary....273

16. C# Anonymous Methods, Lambdas, and Local Functions....274

16.1 Anonymous methods....275

16.2 Creating the LambdaDemo project....276

16.3 Lambdas....280

16.4 Passing multiple parameters....283

16.5 Passing no parameters....284

16.6 Local functions....285

16.7 Creating the LocalFunctions project....286

16.8 Recursive local functions....288

16.9 Lambdas vs. local functions....291

16.10 Take the knowledge test....292

16.11 Summary....293

17. C# Inheritance....294

17.1 What is inheritance?....295

17.2 A C# inheritance example....296

17.3 Creating a subclass in C#....300

17.4 Passing arguments to the base class constructor....303

17.5 Overriding inherited methods....305

17.6 Take the knowledge test....309

17.7 Summary....310

18. C# Abstract Classes....311

18.1 What is a C# abstract class?....312

18.2 Abstract members....313

18.3 Declaring a C# abstract class....314

18.4 Deriving from an abstract class....315

18.5 Creating the AbstractClassDemo project....316

18.6 Abstract vs. virtual members....318

18.7 Take the knowledge test....322

18.8 Summary....323

19. C# Interfaces....324

19.1 Understanding C# interfaces....325

19.2 Declaring an interface....326

19.3 Creating the InterfaceDemo project....328

19.4 Adding a C# interface file....329

19.5 Interface data members....333

19.6 Take the knowledge test....336

19.7 Summary....337

20. C# Structures....338

20.1 An overview of C# structures....339

20.2 Creating the StructureDemo project....341

20.3 Value types vs. reference types....342

20.4 Adding the Struct declaration....343

20.5 Read-only structures....348

20.6 Take the knowledge test....350

20.7 Summary....351

21. C# Tuple Type....352

21.1 Creating the TupleDemo project....353

21.2 Declaring a Tuple....354

21.3 Accessing tuple values....356

21.4 Tuple field names....357

21.5 Returning tuples from methods....359

21.6 Tuples as method parameters....362

21.7 Take the knowledge test....364

21.8 Summary....365

22. C# Namespaces....366

22.1 Understanding scope....367

22.2 An overview of namespaces....370

22.3 Creating the NamespaceDemo project....372

22.4 Declaring namespaces....374

22.5 Accessing namespace members....378

22.6 Namespaces and the “using” keyword....379

22.7 Nested namespaces....382

22.8 Aliases and the namespace alias operator....384

22.9 File scoped namespaces....387

22.10 Take the knowledge test....390

22.11 Summary....391

23. C# Exception Handling....392

23.1 Understanding exception handling....393

23.2 Creating the ExceptionDemo project....394

23.3 Throwing exceptions....397

23.4 Handling exceptions....400

23.5 Creating exception filters with the “when” keyword....403

23.6 Using finally blocks....405

23.7 Using the try-finally Statement....406

23.8 Re-throwing exceptions....411

23.9 Creating custom exception types....413

23.10 Take the knowledge test....418

23.11 Summary....419

24. Asynchronous Programming in C#....420

24.1 An overview of threads....421

24.2 The main thread....422

24.3 Asynchronous programming in C#....423

24.4 Creating the AsyncDemo project....424

24.5 Synchronous code....425

24.6 Understanding the C# Task class....429

24.7 Declaring asynchronous methods....430

24.8 Introducing the await operator....431

24.9 Asynchronous calls from synchronous functions....439

24.10 Canceling asynchronous tasks....441

24.11 Take the knowledge test....446

24.12 Summary....447

25. Creating 2D, 3D, and Jagged Arrays in C#....448

25.1 Creating arrays in C#....449

25.2 Declaring multidimensional arrays....451

25.3 Declaring jagged arrays....454

25.4 Take the knowledge test....455

25.5 Summary....456

26. Accessing and Sorting C# Array Elements....457

26.1 Creating the ArrayDemo Project....458

26.2 Getting the number of dimensions of an array....459

26.3 Accessing array elements....461

26.4 Array iteration....464

26.5 Working with ranges....466

26.6 C# index from end operator....470

26.7 Sorting C# arrays....473

26.8 Clearing C# arrays....475

26.9 Take the knowledge test....476

26.10 Summary....477

27. C# List Collections....478

27.1 Creating the CollectionDemo Project....479

27.2 Introducing the C# Collection Classes....480

27.3 Creating C# list collections with List....481

27.4 Adding items to lists....482

27.5 Initializing a list with multiple values....483

27.6 Accessing list items....484

27.7 Removing items from lists....486

27.8 Inserting items into a list....487

27.9 Sorting lists in C#....488

27.10 Finding items in a C# list....489

27.11 Obtaining information about a list....491

27.12 Clearing C# lists....492

27.13 Take the knowledge test....494

27.14 Summary....495

28. C# Dictionary Collections....496

28.1 Creating the DictionaryDemo Project....497

28.2 Dictionary initialization....498

28.3 Dictionary item count....500

28.4 Dictionary iteration....501

28.5 Adding and removing dictionary entries....503

28.6 Accessing and updating dictionary items....505

28.7 Checking if a key or value exists....507

28.8 Take the knowledge test....509

28.9 Summary....510

29. C# File and Directory Handling....511

29.1 Introducing the System.IO classes....512

29.2 Understanding paths in C#....514

29.3 Creating the FileDemo project....516

29.4 Current working directory....517

29.5 Checking if a directory exists....518

29.6 Creating a Directory....520

29.7 Deleting a Directory....522

29.8 Changing the current working directory....523

29.9 Handling File and Directory Exceptions....524

29.10 File handling using the File class....526

29.10.1 Checking if a file exists....527

29.10.2 Creating and opening files....528

29.10.3 Reading and writing using the File class....530

29.11 Deleting, copying, and moving files....532

29.12 File I/O with streams....533

29.13 Asynchronous file handling....538

29.14 Working with binary streams....540

29.15 Take the knowledge test....542

29.16 Summary....543

30. C# Strings....544

30.1 Creating the StringsDemo Project....545

30.2 Creating strings in C#....546

30.3 Obtaining the length of a C# string....548

30.4 Treating strings as arrays....549

30.5 String character iteration....552

30.6 Concatenating strings....554

30.7 Comparing strings....555

30.8 Changing string case....560

30.9 Splitting a string into multiple parts....561

30.10 Trimming and padding strings....562

30.11 String replacement....564

30.12 Take the knowledge test....565

30.13 Summary....566

31. C# String Formatting....567

31.1 The Syntax of the string Format() method....568

31.2 Creating the StringFormatDemo project....569

31.3 A simple string formatting example....570

31.4 Using format controls....571

31.5 A simple format control example....572

31.6 C# string Format() format controls....573

31.7 Take the knowledge test....575

31.8 Summary....576

32. C# Dates and Times....577

32.1 Creating the DateTimeDemo project....578

32.2 Creating a C# DateTime object....579

32.3 Getting the current system time and date....580

32.4 Adding to or subtracting from dates and times....581

32.5 Retrieving parts of a date and time....583

32.6 Take the knowledge test....585

32.7 Summary....586

Index....587

Unlock the power of modern programming with C# 13 Programming Essentials – .NET 9 Edition, your ultimate guide to mastering C# 13 and the .NET 9 SDK. Whether a beginner or a seasoned developer, this book offers a clear, structured path to becoming proficient in C# development within the Visual Studio Code environment.

This comprehensive guide features 31 in-depth chapters, 30 online quizzes, and access to downloadable project code, ensuring you gain both theoretical knowledge and hands-on experience. Starting with a deep dive into the C# ecosystem, you’ll explore the Common Language Infrastructure (CLI), Common Intermediate Language (CIL), and Virtual Execution System (VES), giving you a solid understanding of the platform’s architecture.

From there, the book walks you through the installation and setup of Visual Studio Code, before guiding you step-by-step through C# fundamentals, including variables, flow control, and loops. As you advance, you’ll master object-oriented programming (OOP) concepts like inheritance, interfaces, and abstract classes.

The book doesn’t stop at the basics—it goes beyond to cover essential advanced topics like string manipulation, working with arrays and collections, exception handling, and asynchronous programming techniques. With practical, real-world examples, you’ll be ready to build robust, efficient applications.

Whether you’re just starting or sharpening your skills, C# 13 Programming Essentials – .NET 9 Edition provides everything you need to succeed in the fast-paced world of C# development. Take your coding skills to the next level with this all-in-one guide.


Похожее:

Список отзывов:

Нет отзывов к книге.