Essential C# 12.0 8 Ed

Essential C# 12.0 8 Ed

Essential C# 12.0 8 Ed
Автор: Michaelis Mark
Дата выхода: 2024
Издательство: Pearson Education Limited
Количество страниц: 1232
Размер файла: 37.7 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

Cover....1

Title Page....2

Copyright Page....3

Contents at a Glance....6

Contents....8

Foreword....16

Preface....18

Acknowledgments....32

About the Author....34

1 Introducing C#....36

Hello, World....37

C# Syntax Fundamentals....47

Working with Variables....59

Console Input and Output....63

Managed Execution and the Common Language Infrastructure....73

Multiple .NET Frameworks....79

Summary....83

2 Data Types....84

Type Name Forms....85

Fundamental Numeric Types....87

More Fundamental Types....98

Conversions between Data Types....119

Summary....127

3 More with Data Types....128

Categories of Types....128

Declaring Types That Allow null....131

Implicitly Typed Local Variables....137

Tuples....138

Arrays....147

Summary....169

4 Operators and Control Flow....172

Operators....172

Introducing Flow Control....191

Code Blocks ({})....196

Code Blocks, Scopes, and Declaration Spaces....199

Boolean Expressions....201

Programming with null....208

Bitwise Operators (<<, >>, |, &, ^, ~)....216

Control Flow Statements, Continued....222

Jump Statements....235

C# Preprocessor Directives....241

Summary....250

5 Parameters and Methods....252

Calling a Method....253

Declaring a Method....260

Local Functions....267

Using Directives....268

Returns and Parameters on Main Method....277

Top-Level Statements....281

Advanced Method Parameters....282

Recursion....296

Method Overloading....299

Optional Parameters....302

Basic Error Handling with Exceptions....307

Summary....326

6 Classes....328

Declaring and Instantiating a Class....333

Instance Fields....337

Instance Methods....340

Using the this Keyword....341

Access Modifiers....349

Properties....351

Constructors....368

Non-Nullable Reference Type Properties with Constructors....381

Nullable Attributes....389

Deconstructors....392

Static Members....394

Extension Methods....405

Encapsulating the Data....407

Nested Classes....411

Partial Classes....414

Summary....419

7 Inheritance....420

Derivation....421

Overriding the Base Class....432

Abstract Classes....445

All Classes Derive from System.Object....452

Type Checking....454

Pattern Matching....458

Avoid Pattern Matching When Polymorphism Is Possible....473

Summary....475

8 Interfaces....478

Introducing Interfaces....479

Polymorphism through Interfaces....481

Interface Implementation....486

Converting between the Implementing Class and Its Interfaces....492

Interface Inheritance....493

Multiple Interface Inheritance....496

Extension Methods on Interfaces....496

Versioning....499

Extension Methods versus Default Interface Members....515

Interfaces Compared with Abstract Classes....517

Interfaces Compared with Attributes....519

Summary....519

9 Introducing Structs and Records....522

Reference Equality versus Value Equality....528

Structs....529

Record Classes....535

Record Class Inheritance....538

Records....539

Overriding object Members....548

Customizing Record Behavior....556

Boxing....558

Enums....567

Summary....579

10 Well-Formed Types....582

Operator Overloading....583

Referencing Other Assemblies....592

Encapsulation of Types....599

Defining Namespaces....602

XML Comments....606

Garbage Collection and Weak References....611

Resource Cleanup....615

Lazy Initialization....631

Summary....633

11 Exception Handling....636

Multiple Exception Types....636

Catching Exceptions....639

Rethrowing an Existing Exception....642

General Catch Block....644

Guidelines for Exception Handling....645

Defining Custom Exceptions....649

Rethrowing a Wrapped Exception....653

Summary....657

12 Generics....658

C# without Generics....659

Introducing Generic Types....665

Constraints....681

Generic Methods....698

Covariance and Contravariance....704

Generic Internals....711

Summary....716

13 Delegates and Lambda Expressions....718

Introducing Delegates....719

Declaring Delegate Types....723

Lambda Expressions....733

Statement Lambdas....734

Expression Lambdas....737

Anonymous Methods....740

Delegates Do Not Have Structural Equality....742

Outer Variables....745

Static Anonymous Functions....747

Expression Trees....751

Summary....759

14 Events....762

Coding the Publish–Subscribe Pattern with Multicast Delegates....763

Understanding Events....778

Summary....788

15 Collection Interfaces with Standard Query Operators....790

Collection Initializers....791

What Makes a Class a Collection: IEnumerable....794

Standard Query Operators....801

Anonymous Types with LINQ....831

Summary....841

16 LINQ with Query Expressions....844

Introducing Query Expressions....845

Query Expressions Are Just Method Invocations....864

Summary....866

17 Building Custom Collections....868

More Collection Interfaces....869

Primary Collection Classes....872

Providing an Indexer....894

Returning null or an Empty Collection....897

Iterators....898

Summary....914

18 Reflection, Attributes, and Dynamic Programming....916

Reflection....916

nameof Operator....929

Attributes....930

Programming with Dynamic Objects....955

Summary....966

19 Introducing Multithreading....968

Multithreading Basics....970

Asynchronous Tasks....978

Canceling a Task....1000

Working with System.Threading....1007

Summary....1008

20 Programming the Task-Based Asynchronous Pattern....1010

Synchronously Invoking a High-Latency Operation....1010

Asynchronously Invoking a High-Latency Operation Using the TPL....1014

The Task-Based Asynchronous Pattern with async and await....1019

Introducing Asynchronous Return of ValueTask....1033

Asynchronous Streams....1029

IAsyncDisposable and the await using Declaration and Statement....1033

Using LINQ with IAsyncEnumerable....1034

Returning void from an Asynchronous Method....1036

Asynchronous Lambdas and Local Functions....1041

Task Schedulers and the Synchronization Context....1048

async/await with the Windows UI....1050

Summary....1054

21 Iterating in Parallel....1056

Executing Loop Iterations in Parallel....1056

Running LINQ Queries in Parallel....1067

Summary....1074

22 Thread Synchronization....1076

Why Synchronization?....1077

Timers....1108

Summary....1111

23 Platform Interoperability and Unsafe Code....1112

Platform Invoke....1113

Pointers and Addresses....1128

Executing Unsafe Code via a Delegate....1139

Summary....1140

24 The Common Language Infrastructure....1142

Defining the Common Language Infrastructure....1142

CLI Implementations....1144

NET Standard....1148

Base Class Library....1148

C# Compilation to Machine Code....1149

Runtime....1151

Assemblies, Manifests, and Modules....1156

Common Intermediate Language....1159

Common Type System....1160

Common Language Specification....1160

Metadata....1161

.NET Native and Ahead of Time Compilation....1162

Summary....1163

Index....1166

A....1167

B....1170

C....1172

D....1179

E....1182

F....1185

G....1187

H....1188

I....1189

J....1192

K....1193

L....1193

M....1195

N....1197

O....1199

P....1201

Q....1205

R....1205

S....1207

T....1214

U....1217

V....1218

W....1219

X....1220

Y....1220

Z....1221

Index of 8.0 Topics....1222

A....1222

B....1222

C....1222

D....1222

I....1222

N....1223

P....1223

R....1223

S....1223

T....1223

U....1224

Index of 9.0 Topics....1225

F....1225

I....1225

P....1225

R....1225

S....1225

T....1225

Index of 10.0 Topics....1226

A....1226

C....1226

E....1226

F....1226

G....1226

I....1226

R....1226

Index of 11.0 Topics....1227

A....1227

E....1227

F....1227

G....1227

I....1227

L....1227

N....1227

P....1227

R....1227

U....1227

Index of 12.0 Topics....1228

A....1228

D....1228

I....1228

P....1228

The Comprehensive, Expert Guide to C# 12.0 for Programmers at All Levels

Updated for the Microsoft C# 12.0 Long Term Support (LTS) release, Essential C# 12.0 is a well-organized, no-fluff C# guide, suitable for every programmer. Building on the proven, high-value content of previous editions, world-class C# expert Mark Michaelis illuminates key enhancements in C# 12.0, including any-type aliases, inline arrays, default lambda expression parameters, and expanded support for primary constructors.

Michaelis presents a comprehensive tutorial and reference for the entire C# language, helping you accelerate your journey to expert-level C# programmer. Succinct examples illustrate core constructs, and modern coding guidelines help you minimize bugs and write code that's easier to evolve. To help you quickly find what you need and maintain compatibility, the book includes version-specific icons and notes identifying when each innovation was introduced.

  • Use structured programming constructs to write functioning code immediately
  • Learn both the complexities and solutions to nullable reference types
  • Thoroughly master C# object constructs, including classes, inheritance, and interfaces
  • Reduce code redundancy with generics, delegates, and lambda expressions
  • Take full advantage of collections with LINQ
  • Improve multithreading with the taskbased async pattern and asynchronous streams
  • Enhance performance through the parallel processing of data and multithreading tasks
  • Make the most of refl ection, attributes, and the declarative programming paradigm
  • Program complex types with enhanced pattern matching syntax
  • Write succinct type defi nitions with record structs and classes
  • Explore the new features of C# 8.0-C# 12.0

Похожее:

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

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