Essential C# 7.0 - Mark Michaelis

Essential C# 7.0

(Autor)

Buch | Softcover
1040 Seiten
2018 | 6th edition
Microsoft Press (Verlag)
978-1-5093-0358-8 (ISBN)
59,60 inkl. MwSt
Zu diesem Artikel existiert eine Nachauflage
The Comprehensive, Expert Guide to C# Language Programming


“This book has been a classic for years, and remains one of the most venerable and trusted titles in the world of C# content, and probably far beyond! . . . Mark is super smart, insists on understanding everything to the core, and has phenomenal insight into how things affect real developers. . . . He goes right to the essence and communicates with great integrity—no sugarcoating—and has a keen eye for practical value and real-world problems.”

–Mads Torgersen, C# Program Manager, Microsoft


Essential C# 7.0 is a well-organized, no-fluff guide to C# 7.0 for programmers at all levels of experience. Reflecting the most important C# features from 3.0 through 7.0 and including modern programming patterns, it will help you write code that’s simple, powerful, robust, secure, and maintainable.

Author Mark Michaelis is a world-class C# expert: a long-time Microsoft MVP and Regional Director who also has served on Microsoft’s C# design review team. He presents a comprehensive tutorial and reference for the entire language, including expert coverage of key C# 7.0 enhancements, C# 7.0’s use with .NET Core/.NET Standard, and cross-platform compilation. He illustrates key C# constructs with succinct examples, and presents best-practice coding guidelines. To help you maintain existing code, separate indexes provide version-specific answers for C# 5.0, 6.0, and 7.0, and visual icons show when each language innovation was introduced.




Make the most of C# 7.0 enhancements, including tuples, deconstructors, pattern matching, local functions, and ref returns
Work efficiently with C# data types, operators, control flow, methods, and parameters
Write more robust code with C# object-oriented constructs
Implement reliable, effective exception handling
Reduce code complexity with generics, delegates, lambda expressions, and events
Leverage advanced dynamic and declarative programming techniques
Query diverse data collections using LINQ with query expressions
Create custom collections that operate against business objects
Access .NET collections via collection interfaces and standard query operators
Master multithreading and synchronization, including the async/await paradigm
Optimize performance and interoperability with P/Invoke and unsafe code
Run your code on Linux or macOS with C# 7.0 cross-platform compilation
Includes C# 7.1, 7.2, and 7.3 language enhancements

This guide offers you a complete foundation for successful development with modern versions of the C# language in any project or environment.

Mark Michaelis is the founder of IntelliTect, a high-end software engineering and consulting company where he serves as the chief technical architect and trainer. Mark speaks at developer conferences and has written numerous articles and books—currently, he is the Essential .NET columnist for MSDN Magazine. Since 1996, Mark has been a Microsoft MVP for C#, Visual Studio Team System, and the Windows SDK. In 2007 he was recognized as a Microsoft Regional Director. He also serves on several Microsoft software design review teams, including C# and VSTS. Mark holds a bachelor of arts in philosophy from the University of Illinois and a masters in computer science from the Illinois Institute of Technology.

Figures xv

Tables xvii

Foreword xix

Preface xxi

Acknowledgments xxxiii

About the Author xxxv

Chapter 1: Introducing C# 1

Hello, World 2

C# Syntax Fundamentals 11

Working with Variables 20

Console Input and Output 24

Managed Execution and the Common Language Infrastructure 32

Multiple .NET Frameworks 37

Chapter 2: Data Types 43

Fundamental Numeric Types 44

More Fundamental Types 53

null and void 67

Conversions between Data Types 69

Chapter 3: More with Data Types 77

Categories of Types 77

Nullable Modifier 80

Tuples 83

Arrays 90

Chapter 4: Operators and Control Flow 109

Operators 110

Introducing Flow Control 126

Code Blocks ({}) 132

Code Blocks, Scopes, and Declaration Spaces 135

Boolean Expressions 137

Bitwise Operators (<<, >>, |, &, ^, ~) 147

Control Flow Statements, Continued 153

Jump Statements 165

C# Preprocessor Directives 171

Chapter 5: Methods and Parameters 181

Calling a Method 182

Declaring a Method 189

The using Directive 195

Returns and Parameters on Main() 200

Advanced Method Parameters 203

Recursion 215

Method Overloading 217

Optional Parameters 220

Basic Error Handling with Exceptions 225

Chapter 6: Classes 241

Declaring and Instantiating a Class 245

Instance Fields 249

Instance Methods 251

Using the this Keyword 252

Access Modifiers 259

Properties 261

Constructors 278

Static Members 289

Extension Methods 299

Encapsulating the Data 301

Nested Classes 304

Partial Classes 307

Chapter 7: Inheritance 313

Derivation 314

Overriding the Base Class 326

Abstract Classes 338

All Classes Derive from System.Object 344

Verifying the Underlying Type with the is Operator 345

Pattern Matching with the is Operator 346

Pattern Matching within a switch Statement 347

Conversion Using the as Operator 349

Chapter 8: Interfaces 353

Introducing Interfaces 354

Polymorphism through Interfaces 355

Interface Implementation 360

Converting between the Implementing Class and Its Interfaces 366

Interface Inheritance 366

Multiple Interface Inheritance 369

Extension Methods on Interfaces 369

Implementing Multiple Inheritance via Interfaces 371

Versioning 374

Interfaces Compared with Classes 375

Interfaces Compared with Attributes 377

Chapter 9: Value Types 379

Structs 383

Boxing 390

Enums 398

Chapter 10: Well-Formed Types 411

Overriding object Members 411

Operator Overloading 424

Referencing Other Assemblies 432

Defining Namespaces 442

XML Comments 445

Garbage Collection 449

Resource Cleanup 452

Lazy Initialization 461

Chapter 11: Exception Handling 465

Multiple Exception Types 465

Catching Exceptions 469

General Catch Block 473

Guidelines for Exception Handling 475

Defining Custom Exceptions 479

Rethrowing a Wrapped Exception 483

Chapter 12: Generics 487

C# without Generics 488

Introducing Generic Types 493

Constraints 506

Generic Methods 519

Covariance and Contravariance 524

Generic Internals 531

Chapter 13: Delegates and Lambda Expressions 537

Introducing Delegates 538

Declaring Delegate Types 542

Lambda Expressions 550

Anonymous Methods 556

Chapter 14: Events 575

Coding the Publish-Subscribe Pattern with Multicast Delegates 576

Understanding Events 591

Chapter 15: Collection Interfaces with Standard Query Operators 603

Collection Initializers 604

What Makes a Class a Collection: IEnumerable 607

Standard Query Operators 613

Anonymous Types with LINQ 646

Chapter 16: LINQ with Query Expressions 657

Introducing Query Expressions 658

Query Expressions Are Just Method Invocations 676

Chapter 17: Building Custom Collections 679

More Collection Interfaces 680

Primary Collection Classes 683

Providing an Indexer 702

Returning Null or an Empty Collection 705

Iterators 705

Chapter 18: Reflection, Attributes, and Dynamic Programming 721

Reflection 722

nameof Operator 733

Attributes 735

Programming with Dynamic Objects 759

Chapter 19: Multithreading 771

Multithreading Basics 774

Working with System.Threading 781

Asynchronous Tasks 789

Canceling a Task 810

The Task-based Asynchronous Pattern 816

Executing Loop Iterations in Parallel 846

Running LINQ Queries in Parallel 856

Chapter 20: Thread Synchronization 863

Why Synchronization? 864

Timers 893

Chapter 21: Platform Interoperability and Unsafe Code 897

Platform Invoke 898

Pointers and Addresses 910

Executing Unsafe Code via a Delegate 920

Chapter 22: The Common Language Infrastructure 923

Defining the Common Language Infrastructure 924

CLI Implementations 925

.NET Standard 928

Base Class Library 929

C# Compilation to Machine Code 929

Runtime 932

Assemblies, Manifests, and Modules 936

Common Intermediate Language 939

Common Type System 939

Common Language Specification 940

Metadata 941

.NET Native and Ahead of Time Compilation 942

Index 945

Index of 7.0 Topics 995

Index of 6.0 Topics 998

Index of 5.0 Topics 1001

Erscheinungsdatum
Reihe/Serie Addison-Wesley Microsoft Technology Series
Verlagsort Boston
Sprache englisch
Maße 180 x 230 mm
Gewicht 1660 g
Themenwelt Mathematik / Informatik Informatik Netzwerke
Informatik Programmiersprachen / -werkzeuge NET Programmierung
Mathematik / Informatik Informatik Software Entwicklung
ISBN-10 1-5093-0358-8 / 1509303588
ISBN-13 978-1-5093-0358-8 / 9781509303588
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
Grundlagen, Profiwissen und Rezepte

von Jürgen Kotz; Christian Wenz

Buch (2024)
Carl Hanser (Verlag)
49,99
Grundlagen, Profiwissen und Rezepte

von Jürgen Kotz; Christian Wenz

Buch (2022)
Hanser, Carl (Verlag)
49,99