C# 7 and .NET Core Cookbook

Quick solutions to common programming problems with the latest features of C# 7.0, .NET Core 1.1, and Visual Studio 2017

C# 7 and .NET Core Cookbook

This ebook is included in a Mapt subscription
Dirk Strauss

1 customer reviews
Quick solutions to common programming problems with the latest features of C# 7.0, .NET Core 1.1, and Visual Studio 2017
$10.00
$49.99
RRP $39.99
RRP $49.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781787286276
Paperback628 pages

Book Description

C# has recently been open-sourced and C# 7 comes with a host of new features for building powerful, cross-platform applications.

This book will be your solution to some common programming problems that you come across with C# and will also help you get started with .NET Core 1.1. Through a recipe-based approach, this book will help you overcome common programming challenges and get your applications ready to face the modern world.

We start by running you through new features in C# 7, such as tuples, pattern matching, and so on, giving you hands-on experience with them. Moving forward, you will work with generics and the OOP features in C#. You will then move on to more advanced topics, such as reactive extensions, Regex, code analyzers, and asynchronous programming. This book will also cover new, cross-platform .NET Core 1.1 features and teach you how to utilize .NET Core on macOS. Then, we will explore microservices as well as serverless computing and how these benefit modern developers. Finally, you will learn what you can do with Visual Studio 2017 to put mobile application development across multiple platforms within the reach of any developer.

Table of Contents

Chapter 1: New Features in C# 7.0
Introduction
Working with Tuples - getting started
Working with Tuples - going deeper
Pattern matching
Out variables
Deconstruction
Local functions
Improvements to literals
Ref returns and locals
Generalized async return types
Expression bodies for accessors, constructors, and finalizers
throw expressions
Chapter 2: Classes and Generics
Introduction
Creating and implementing an abstract class
Creating and implementing an interface
Creating and using a generic class or method
Creating and using a generic interface
Chapter 3: Object-Oriented Programming in C#
Introduction
Using inheritance in C#
Using abstraction
Leveraging encapsulation
Implementing polymorphism
Single responsibility principle
Open/closed principle
Exception handling
Chapter 4: Code Analyzers in Visual Studio
Introduction
Finding and installing analyzers
Creating a code analyzer
Creating a custom code analyzer
Deploying your code analyzer within your organization only
Chapter 5: Regular Expressions
Introduction
Getting started with regex - Matching a valid date
Sanitizing input
Dynamic regex matching
Chapter 6: Working with Files, Streams, and Serialization
Introduction
Creating and extracting ZIP archives
In-memory stream compression and decompression
Async and await file processing
How to make a custom type serializable?
Using ISerializable for custom serialization to a FileStream
Using XmlSerializer
JSON serializers
Chapter 7: Making Apps Responsive with Asynchronous Programming
Introduction
Return types of asynchronous functions
Handling tasks in asynchronous programming
Exception handling in asynchronous programming
Chapter 8: High Performance Programming Using Parallel and Multithreading in C#
Introduction
Creating and aborting a low-priority background thread
Increasing the maximum thread pool size
Creating multiple threads
Locking one thread until the contended resources are available
Invoking parallel calls to methods using Parallel.Invoke
Using a parallel foreach loop
Cancelling a parallel foreach loop
Catching errors in parallel foreach loops
Debugging multiple threads
Chapter 9: Composing Event-Based Programs Using Reactive Extensions
Introduction
Installing Rx
Events versus observables
Using LINQ to perform queries
Using schedulers in Rx
Debugging lambda expressions
Chapter 10: Exploring .NET Core 1.1
Introduction
Creating a simple .NET Core application and running it on a Mac
Creating your first ASP.NET Core application
Publishing your ASP.NET Core application
Chapter 11: ASP.NET Core on the MVC Framework
Introduction
Including middleware and why it is useful
Creating Controllers and using routing
Rendering Views
Chapter 12: Choosing and Using a Source Control Strategy
Introduction
Setting up Visual Studio account management and determining which source control solution is best for you
Setting up Visual Studio GitHub integration, checking in code for the first time, and checking in changes
Working as a team using GitHub, handling and resolving conflicts in code
Chapter 13: Creating a Mobile Application in Visual Studio
Introduction
Installing Xamarin and other required components on your Windows PC and Mac
Creating a mobile application using Apache Cordova
Creating an iOS application using Xamarin.Forms and Visual Studio for Mac
Chapter 14: Writing Secure Code and Debugging in Visual Studio
Introduction
Encrypting and storing passwords correctly
Using SecureString in code
Securing sensitive parts of the App.config/web.config
Preventing SQL injection attacks
Using IntelliTrace, diagnostic tools, and historical debugging
Setting conditional breakpoints
Using PerfTips to identify bottlenecks in code
Chapter 15: Creating Microservices on Azure Service Fabric
Introduction
Downloading and installing Service Fabric
Creating a Service Fabric application with a stateless actor service
Using Service Fabric Explorer
Chapter 16: Azure and Serverless Computing
Introduction
Creating an Azure function
Providing print functionality with DocRaptor
Using AWS and S3
Creating C# Lambda functions with AWS

What You Will Learn

  • Writing better and less code to achieve the same result as in previous versions of C#
  • Working with analyzers in Visual Studio
  • Working with files, streams, and serialization
  • Writing high-performant code in C# and understanding multi-threading
  • Demystifying the Rx library using Reactive extensions
  • Exploring .Net Core 1.1 and ASP.NET MVC
  • Securing your applications and learning new debugging techniques
  • Designing and building a microservice architecture
  • Using Azure and AWS for serverless computing with C#

Authors

Table of Contents

Chapter 1: New Features in C# 7.0
Introduction
Working with Tuples - getting started
Working with Tuples - going deeper
Pattern matching
Out variables
Deconstruction
Local functions
Improvements to literals
Ref returns and locals
Generalized async return types
Expression bodies for accessors, constructors, and finalizers
throw expressions
Chapter 2: Classes and Generics
Introduction
Creating and implementing an abstract class
Creating and implementing an interface
Creating and using a generic class or method
Creating and using a generic interface
Chapter 3: Object-Oriented Programming in C#
Introduction
Using inheritance in C#
Using abstraction
Leveraging encapsulation
Implementing polymorphism
Single responsibility principle
Open/closed principle
Exception handling
Chapter 4: Code Analyzers in Visual Studio
Introduction
Finding and installing analyzers
Creating a code analyzer
Creating a custom code analyzer
Deploying your code analyzer within your organization only
Chapter 5: Regular Expressions
Introduction
Getting started with regex - Matching a valid date
Sanitizing input
Dynamic regex matching
Chapter 6: Working with Files, Streams, and Serialization
Introduction
Creating and extracting ZIP archives
In-memory stream compression and decompression
Async and await file processing
How to make a custom type serializable?
Using ISerializable for custom serialization to a FileStream
Using XmlSerializer
JSON serializers
Chapter 7: Making Apps Responsive with Asynchronous Programming
Introduction
Return types of asynchronous functions
Handling tasks in asynchronous programming
Exception handling in asynchronous programming
Chapter 8: High Performance Programming Using Parallel and Multithreading in C#
Introduction
Creating and aborting a low-priority background thread
Increasing the maximum thread pool size
Creating multiple threads
Locking one thread until the contended resources are available
Invoking parallel calls to methods using Parallel.Invoke
Using a parallel foreach loop
Cancelling a parallel foreach loop
Catching errors in parallel foreach loops
Debugging multiple threads
Chapter 9: Composing Event-Based Programs Using Reactive Extensions
Introduction
Installing Rx
Events versus observables
Using LINQ to perform queries
Using schedulers in Rx
Debugging lambda expressions
Chapter 10: Exploring .NET Core 1.1
Introduction
Creating a simple .NET Core application and running it on a Mac
Creating your first ASP.NET Core application
Publishing your ASP.NET Core application
Chapter 11: ASP.NET Core on the MVC Framework
Introduction
Including middleware and why it is useful
Creating Controllers and using routing
Rendering Views
Chapter 12: Choosing and Using a Source Control Strategy
Introduction
Setting up Visual Studio account management and determining which source control solution is best for you
Setting up Visual Studio GitHub integration, checking in code for the first time, and checking in changes
Working as a team using GitHub, handling and resolving conflicts in code
Chapter 13: Creating a Mobile Application in Visual Studio
Introduction
Installing Xamarin and other required components on your Windows PC and Mac
Creating a mobile application using Apache Cordova
Creating an iOS application using Xamarin.Forms and Visual Studio for Mac
Chapter 14: Writing Secure Code and Debugging in Visual Studio
Introduction
Encrypting and storing passwords correctly
Using SecureString in code
Securing sensitive parts of the App.config/web.config
Preventing SQL injection attacks
Using IntelliTrace, diagnostic tools, and historical debugging
Setting conditional breakpoints
Using PerfTips to identify bottlenecks in code
Chapter 15: Creating Microservices on Azure Service Fabric
Introduction
Downloading and installing Service Fabric
Creating a Service Fabric application with a stateless actor service
Using Service Fabric Explorer
Chapter 16: Azure and Serverless Computing
Introduction
Creating an Azure function
Providing print functionality with DocRaptor
Using AWS and S3
Creating C# Lambda functions with AWS

Book Details

ISBN 139781787286276
Paperback628 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition Book Cover
C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition
$ 10.00
C# 6 and .NET Core 1.0: Modern Cross-Platform Development Book Cover
C# 6 and .NET Core 1.0: Modern Cross-Platform Development
$ 10.00