Professional C# and .NET, 2021st Edition

Book description

Get the latest coverage of the newest features in C#9 and .NET 5 

In Professional C# and .NET: 2021 Edition, Microsoft MVP for Visual Studio and Development Technologies and veteran developer, Christian Nagel, delivers a comprehensive tour of the new features and capabilities of C#9 and .NET 5. 

Experienced programmers making the transition to C# will benefit from the author’s in-depth explorations to create Web- and Windows applications using ASP.NET Core, Blazor, and WinUI using modern application patterns and new features offered by .NET including Microservices deployed to Docker images, GRPC, localization, asynchronous streaming, and much more.  

The book also offers: 

  • Discussions of the extension of .NET to non-Microsoft platforms like OSX and Linux 
  • Explanations of the newest features in C#9, including support for record types,  and enhanced support for tuples, pattern matching, and nullable reference types 
  • Integrating .NET applications with Microsoft Azure services such as Azure App Configuration, Azure Key Vault, Azure Functions, the Azure Active Directory, and others 
  • Downloadable code examples from wrox.com and github.com with online updates for C# 10 and .NET 6 

Perfect for programmers with a background in C#, Visual Basic, Java, or C/C++, Professional C# and .NET: 2021 Edition will also earn a place in the libraries of software architects seeking an up-to-date and fulsome treatment of the latest C# and .NET releases. 

Table of contents

  1. COVER
  2. TITLE PAGE
  3. INTRODUCTION
    1. THE WORLD OF .NET
    2. THE WORLD OF C#
    3. WHAT'S NEW IN C#
    4. WHAT'S NEW IN ASP.NET CORE
    5. WHAT'S NEW WITH WINDOWS
    6. WHAT YOU NEED TO WRITE AND RUN C# CODE
    7. WHAT THIS BOOK COVERS
    8. CONVENTIONS
    9. SOURCE CODE
    10. ERRATA
  4. PART I: The C# Language
    1. 1 .NET Applications and Tools
      1. FROM .NET FRAMEWORK TO .NET CORE TO .NET
      2. .NET TERMS
      3. .NET SUPPORT LENGTH
      4. APPLICATION TYPES AND TECHNOLOGIES
      5. DEVELOPER TOOLS
      6. USING THE . NET CLI
      7. SUMMARY
    2. 2 Core C#
      1. FUNDAMENTALS OF C#
      2. NULLABLE TYPES
      3. USING PREDEFINED TYPES
      4. CONTROLLING PROGRAM FLOW
      5. ORGANIZATION WITH NAMESPACES
      6. WORKING WITH STRINGS
      7. COMMENTS
      8. C# PREPROCESSOR DIRECTIVES
      9. C# PROGRAMMING GUIDELINES
      10. SUMMARY
    3. 3 Classes, Records, Structs, and Tuples
      1. CREATING AND USING TYPES
      2. PASS BY VALUE OR BY REFERENCE
      3. CLASSES
      4. RECORDS
      5. STRUCTS
      6. ENUM TYPES
      7. REF, IN, AND OUT
      8. TUPLES
      9. VALUETUPLE
      10. DECONSTRUCTION
      11. PATTERN MATCHING
      12. PARTIAL TYPES
      13. SUMMARY
    4. 4 Object-Oriented Programming in C#
      1. OBJECT ORIENTATION
      2. INHERITANCE WITH CLASSES
      3. MODIFIERS
      4. INHERITANCE WITH RECORDS
      5. USING INTERFACES
      6. GENERICS
      7. SUMMARY
    5. 5 Operators and Casts
      1. OPERATORS
      2. USING BINARY OPERATORS
      3. TYPE SAFETY
      4. OPERATOR OVERLOADING
      5. COMPARING OBJECTS FOR EQUALITY
      6. IMPLEMENTING CUSTOM INDEXERS
      7. USER-DEFINED CONVERSIONS
      8. SUMMARY
    6. 6 Arrays
      1. MULTIPLE OBJECTS OF THE SAME TYPE
      2. SIMPLE ARRAYS
      3. MULTIDIMENSIONAL ARRAYS
      4. JAGGED ARRAYS
      5. ARRAY CLASS
      6. ARRAYS AS PARAMETERS
      7. ENUMERATORS
      8. USING SPAN WITH ARRAYS
      9. INDICES AND RANGES
      10. ARRAY POOLS
      11. BITARRAY
      12. SUMMARY
    7. 7 Delegates, Lambdas, and Events
      1. REFERENCING METHODS
      2. DELEGATES
      3. LAMBDA EXPRESSIONS
      4. EVENTS
      5. SUMMARY
    8. 8 Collections
      1. OVERVIEW
      2. COLLECTION INTERFACES AND TYPES
      3. LISTS
      4. STACKS
      5. LINKED LISTS
      6. SORTED LIST
      7. DICTIONARIES
      8. SETS
      9. PERFORMANCE
      10. IMMUTABLE COLLECTIONS
      11. SUMMARY
    9. 9 Language Integrated Query
      1. LINQ OVERVIEW
      2. STANDARD QUERY OPERATORS
      3. PARALLEL LINQ
      4. EXPRESSION TREES
      5. LINQ PROVIDERS
      6. SUMMARY
    10. 10 Errors and Exceptions
      1. HANDLING ERRORS
      2. PREDEFINED EXCEPTION CLASSES
      3. CATCHING EXCEPTIONS
      4. USER-DEFINED EXCEPTION CLASSES
      5. CALLER INFORMATION
      6. SUMMARY
    11. 11 Tasks and Asynchronous Programming
      1. WHY ASYNCHRONOUS PROGRAMMING IS IMPORTANT
      2. TASK-BASED ASYNC PATTERN
      3. TASKS
      4. ERROR HANDLING
      5. CANCELLATION OF ASYNC METHODS
      6. ASYNC STREAMS
      7. ASYNC WITH WINDOWS APPS
      8. SUMMARY
    12. 12 Reflection, Metadata, and Source Generators
      1. INSPECTING CODE AT RUNTIME AND DYNAMIC PROGRAMMING
      2. CUSTOM ATTRIBUTES
      3. USING REFLECTION
      4. USING DYNAMIC LANGUAGE EXTENSIONS FOR REFLECTION
      5. EXPANDOOBJECT
      6. SOURCE GENERATORS
      7. SUMMARY
    13. 13 Managed and Unmanaged Memory
      1. MEMORY
      2. MEMORY MANAGEMENT UNDER THE HOOD
      3. STRONG AND WEAK REFERENCES
      4. WORKING WITH UNMANAGED RESOURCES
      5. UNSAFE CODE
      6. SPAN<T>
      7. PLATFORM INVOKE
      8. SUMMARY
  5. PART II: Libraries
    1. 14 Libraries, Assemblies, Packages, and NuGet
      1. THE HELL OF LIBRARIES
      2. ASSEMBLIES
      3. CREATING AND USING LIBRARIES
      4. CREATING NUGET PACKAGES
      5. MODULE INITIALIZERS
      6. SUMMARY
    2. 15 Dependency Injection and Configuration
      1. WHAT IS DEPENDENCY INJECTION?
      2. USING THE .NET DI CONTAINER
      3. USING THE HOST CLASS
      4. LIFETIME OF SERVICES
      5. INITIALIZATION OF SERVICES USING OPTIONS
      6. USING CONFIGURATION FILES
      7. CONFIGURATION WITH .NET APPLICATIONS
      8. AZURE APP CONFIGURATION
      9. SUMMARY
    3. 16 Diagnostics and Metrics
      1. DIAGNOSTICS OVERVIEW
      2. LOGGING
      3. METRICS
      4. ANALYTICS WITH VISUAL STUDIO APP CENTER
      5. APPLICATION INSIGHTS
      6. SUMMARY
    4. 17 Parallel Programming
      1. OVERVIEW
      2. PARALLEL CLASS
      3. TASKS
      4. CANCELLATION FRAMEWORK
      5. CHANNELS
      6. TIMERS
      7. THREADING ISSUES
      8. INTERLOCKED
      9. MONITOR
      10. SPINLOCK
      11. WAITHANDLE
      12. MUTEX
      13. SEMAPHORE
      14. EVENTS
      15. BARRIER
      16. READERWRITERLOCKSLIM
      17. LOCKS WITH AWAIT
      18. SUMMARY
    5. 18 Files and Streams
      1. OVERVIEW
      2. MANAGING THE FILE SYSTEM
      3. ITERATING FILES
      4. WORKING WITH STREAMS
      5. USING READERS AND WRITERS
      6. COMPRESSING FILES
      7. WATCHING FILE CHANGES
      8. JSON SERIALIZATION
      9. USING FILES AND STREAMS WITH THE WINDOWS RUNTIME
      10. SUMMARY
    6. 19 Networking
      1. OVERVIEW
      2. WORKING WITH UTILITY CLASSES
      3. USING SOCKETS
      4. USING TCP CLASSES
      5. USING UDP
      6. USING WEB SERVERS
      7. THE HTTPCLIENT CLASS
      8. HTTPCLIENT FACTORY
      9. SUMMARY
    7. 20 Security
      1. ELEMENTS OF SECURITY
      2. VERIFYING USER INFORMATION
      3. ENCRYPTING DATA
      4. ENSURING WEB SECURITY
      5. SUMMARY
    8. 21 Entity Framework Core
      1. INTRODUCING EF CORE
      2. CREATING A MODEL
      3. SCAFFOLDING A MODEL FROM THE DATABASE
      4. MIGRATIONS
      5. WORKING WITH QUERIES
      6. LOADING RELATED DATA
      7. WORKING WITH RELATIONSHIPS
      8. SAVING DATA
      9. CONFLICT HANDLING
      10. USING TRANSACTIONS
      11. USING AZURE COSMOS DB
      12. SUMMARY
    9. 22 Localization
      1. GLOBAL MARKETS
      2. NAMESPACE SYSTEM.GLOBALIZATION
      3. RESOURCES
      4. LOCALIZATION WITH ASP.NET CORE
      5. LOCALIZATION WITH WINUI
      6. SUMMARY
    10. 23 Tests
      1. OVERVIEW
      2. UNIT TESTING
      3. USING A MOCKING LIBRARY
      4. ASP.NET CORE INTEGRATION TESTING
      5. SUMMARY
  6. PART III: Web Applications and Services
    1. 24 ASP.NET Core
      1. UNDERSTANDING WEB TECHNOLOGIES
      2. CREATING AN ASP.NET CORE WEB PROJECT
      3. ADDING CLIENT-SIDE CONTENT
      4. CREATING CUSTOM MIDDLEWARE
      5. ENDPOINT ROUTING
      6. REQUEST AND RESPONSE
      7. SESSION STATE
      8. HEALTH CHECKS
      9. DEPLOYMENT
      10. SUMMARY
    2. 25 Services
      1. UNDERSTANDING TODAY'S SERVICES
      2. REST SERVICES WITH ASP.NET CORE
      3. CREATING A .NET CLIENT
      4. USING EF CORE WITH SERVICES
      5. AUTHENTICATION AND AUTHORIZATION WITH AZURE AD B2C
      6. IMPLEMENTING AND USING SERVICES WITH GRPC
      7. USING AZURE FUNCTIONS
      8. MORE AZURE SERVICES
      9. SUMMARY
    3. 26 Razor Pages and MVC
      1. SETTING UP SERVICES FOR RAZOR PAGES AND MVC
      2. RAZOR PAGES
      3. ASP.NET CORE MVC
      4. SUMMARY
    4. 27 Blazor
      1. BLAZOR SERVER AND BLAZOR WEBASSEMBLY
      2. CREATING A BLAZOR SERVER WEB APPLICATION
      3. BLAZOR WEBASSEMBLY
      4. RAZOR COMPONENTS
      5. SUMMARY
    5. 28 SignalR
      1. OVERVIEW
      2. CREATING A SIMPLE CHAT USING SIGNALR
      3. GROUPING CONNECTIONS
      4. STREAMING WITH SIGNALR
      5. SUMMARY
  7. PART IV: Apps
    1. 29 Windows Apps
      1. INTRODUCING WINDOWS APPS
      2. INTRODUCING XAML
      3. WORKING WITH CONTROLS
      4. WORKING WITH DATA BINDING
      5. IMPLEMENTING NAVIGATION
      6. IMPLEMENTING LAYOUT PANELS
      7. SUMMARY
    2. 30 Patterns with XAML Apps
      1. WHY MVVM?
      2. DEFINING THE MVVM PATTERN
      3. SAMPLE SOLUTION
      4. MODELS
      5. SERVICES
      6. VIEW MODELS
      7. VIEWS
      8. MESSAGING USING EVENTS
      9. SUMMARY
    3. 31 Styling Windows Apps
      1. STYLING
      2. SHAPES
      3. GEOMETRY
      4. TRANSFORMATION
      5. BRUSHES
      6. STYLES AND RESOURCES
      7. TEMPLATES
      8. ANIMATIONS
      9. VISUAL STATE MANAGER
      10. SUMMARY
  8. INDEX
  9. COPYRIGHT
  10. DEDICATION
  11. ABOUT THE AUTHOR
    1. ABOUT THE TECHNICAL EDITOR
  12. ACKNOWLEDGMENTS
  13. END USER LICENSE AGREEMENT

Product information

  • Title: Professional C# and .NET, 2021st Edition
  • Author(s): Christian Nagel
  • Release date: September 2021
  • Publisher(s): Wrox
  • ISBN: 9781119797203