▶Book Description
C# 7.1 and .NET Core 2.0 is a practical guide to creating powerful cross-platform applications with C# 7.1 and .NET Core 2.0. It gives readers of any experience level a solid foundation in C# and .NET. The first part of the book runs you through the basics of C#, as well as debugging functions and object-oriented programming, before taking a quick tour through the latest features of C# 7.1 such as default literals, tuples, inferred tuple names, pattern matching, and more.
After quickly taking you through C# and how .NET works, you'll explore the .NET Standard 2.0 class libraries, covering topics such as packaging and deploying your own libraries, and using common libraries for working with collections, performance, databases, and encryption. The final section demonstrates the major types of application that you can build and deploy cross-device and cross-platform. Here, you'll learn about websites, web applications, web services, Universal Windows Platform (UWP) apps, and mobile apps. By the end of the book, you'll be armed with all the knowledge you need to build modern, cross-platform applications using C# and .NET.
▶What You Will Learn
- Build cross-platform applications using C# 7.1 and .NET Core 2.0
- Explore ASP.NET Core 2.0 and learn how to create professional websites, services, and applications
- Improve your application's performance using multitasking
- Use Entity Framework Core and LINQ to query and manipulate data
- Master object-oriented programming with C# to increase code reuse and efficiency
- Familiarize yourself with cross-device app development using the Universal Windows Platform
- Protect and manage your files and data with encryption, streams, and serialization
- Get started with mobile app development using Xamarin.Forms
- Preview the nullable reference type feature of C# 8
▶Key Features
- Build modern, cross-platform applications with .NET Core 2.0
- Get up to speed with C#, and up to date with all the latest features of C# 7.1
- Start creating professional web applications with ASP.NET Core 2.0
▶Who This Book Is For
If you have heard that C# is a popular general-purpose programming language used to create every type of software, ranging from web applications and services, to business applications and games, then this book is for you.
If you have heard that C# can create software that runs on a wide range of devices, from desktop to server, from mobile to gaming systems such as Xbox One, then this book is for you.
If you have heard that .NET Core is Microsoft's bet on a cross-platform .NET future, optimized for server-side web development in the cloud, and Augmented Reality (AR) or Virtual Reality (VR) devices such as HoloLens, then this book is for you.
If you have heard that Microsoft has a popular cross-platform developer tool named Visual Studio Code that creates these cross-platform apps, and you are curious to try it, then this book is for you. Conventions
▶What this book covers
- Chapter 1, Hello, C#! Welcome, .NET Core!, is about setting up your development environment and using various tools to create the simplest application possible with C#. You will learn how to write and compile code using Visual Studio 2017 on Windows; Visual Studio Code on macOS, Linux, or Windows; or Visual Studio for Mac on macOS. You will learn the different .NET technologies: .NET Framework, .NET Core, .NET Standard, and .NET Native.
Part 1 –. C# 7.1
- Chapter 2, Speaking C#, explains the grammar and vocabulary that you will use every day to write the source code for your applications. In particular, you will learn how to declare and work with variables of different types.
- Chapter 3, Controlling the Flow and Converting Types, talks about writing code that makes decisions, repeats a block of statements, and converts between types, and writing code defensively to handle errors when they inevitably occur. You will also learn the best places to look for help.
- Chapter 4, Writing, Debugging, and Testing Functions, is about following the Don't Repeat Yourself (DRY) principle by writing reusable functions, and learning how to use debugging tools to track down and remove bugs, monitoring your code while it executes to diagnose problems, and rigorously testing your code to remove bugs and ensure stability and reliability before it gets deployed into production.
- Chapter 5, Building Your Own Types with Object-Oriented Programming, discusses all the different categories of members that a type can have, including fields to store data and methods to perform actions. You will use OOP concepts, such as aggregation and encapsulation. You will learn the C# 7 language features such as tuple syntax support and out variables, and C# 7.1 language features such as default literals and inferred tuple names.
- Chapter 6, Implementing Interfaces and Inheriting Classes, explains deriving new types from existing ones using object-oriented programming (OOP). You will learn how to define operators and C# 7 local functions, delegates and events, how to implement interfaces about base and derived classes, how to override a type member, how to use polymorphism, how to create extension methods, and how to cast between classes in an inheritance hierarchy.
Part 2 –. .NET Core 2.0 and .NET Standard 2.0
- Chapter 7, Understanding and Packaging .NET Standard Types, presents .NET Core 2.0 types that are part of .NET Standard 2.0, and how they are related to C#. You will learn how to deploy and package your own apps and libraries.
- Chapter 8, Using Common .NET Standard Types, discusses the .NET Standard types that allow your code to perform common practical tasks, such as manipulating numbers and text, storing items in collections, and implementing internationalization.
- Chapter 9, Working with Files, Streams, and Serialization, talks about interacting with the filesystem, reading and writing to files and streams, text encoding, and serialization.
- Chapter 10, Protecting Your Data and Applications, is about protecting your data from being viewed by malicious users using encryption and from being manipulated or corrupted using hashing and signing. You will also learn about authentication and authorization to protect applications from unauthorized uses.
- Chapter 11, Working with Databases Using Entity Framework Core, explains reading and writing to databases, such as Microsoft SQL Server and SQLite, using the object-relational mapping technology named Entity Framework Core.
- Chapter 12, Querying and Manipulating Data Using LINQ, teaches you Language INtegrated Query (LINQ)—.language extensions that add the ability to work with sequences of items and filter, sort, and project them into different outputs.
- Chapter 13, Improving Performance and Scalability Using Multitasking, discusses allowing multiple actions to occur at the same time to improve performance, scalability, and user productivity. You will learn about the C# 7.1 async Main feature, and how to use types in the System.Diagnostics namespace to monitor your code to measure performance and efficiency.
Part 3 –. App Models
- Chapter 14, Building Web Sites Using ASP.NET Core Razor Pages, is about learning the basics of building websites with a modern HTTP architecture on the server-side using ASP.NET Core. You will learn the new ASP.NET Core feature known as Razor Pages that simplifies creating web pages for small web sites.
- Chapter 15, Building Web Sites Using ASP.NET Core MVC, is about learning how to build large, complex websites in a way that is easy to unit test and manage with teams of programmers using ASP.NET Core. You will learn about startup configuration, authentication, routes, models, views, and controllers in ASP.NET Core MVC.
- Chapter 16, Building Web Services and Applications Using ASP.NET Core, explains building web applications with a combination of a modern frontend technology, such as Angular or React, and a backend REST architecture web service using ASP.NET Core Web API.
- Chapter 17, Building Windows Apps Using XAML and Fluent Design, talks about learning the basics of XAML that can be used to define the user interface for a graphical app for the Universal Windows Platform (UWP), and applying principles and features of Fluent Design to light it up. This app can then run on any device running Windows 10, Xbox One, and even Mixed Reality devices such as HoloLens.
- Chapter 18, Building Mobile Apps Using XAML and Xamarin.Forms, discusses introducing you to taking C# mobile by building a cross-platform app for iOS and Android. The clientside mobile app will be created with Visual Studio for Mac using XAML and Xamarin.Forms.
- Appendix, Answers to the Test Your Knowledge Questions, has the answers to the test questions at the end of each chapter.