Book Image

.NET Standard 2.0 Cookbook

By : Fiqri Ismail
Book Image

.NET Standard 2.0 Cookbook

By: Fiqri Ismail

Overview of this book

The .NET Standard is a standard that represents a set of APIs that all .NET platforms have to implement, making it easy for developers to access and use one common library for their development needs. This book begins with a quick refresher, helping you understand the mechanics of the new standard and offering insight into how it works. You’ll explore the core library concepts, such as working with collections, configurations, I/O, security, and multithreading. You’ll explore the iOS and Android libraries of Xamarin and we’ll guide you through creating a .NET Standard 2.0 library, which you’ll use with both Android and iOS applications. In the final chapters, you’ll learn the various debugging and diagnostics tools to deliver quality libraries and create a NuGet package of the .NET Standard 2.0 library. By the end of this book, you’ll be able to expand your current workflow to various .NET flavors and have the essential skills to create a .NET Standard 2.0 library from scratch to package and deliver it to the world.
Table of Contents (18 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Creating a .NET Standard 2.0 library that uses tuples


In this recipe, we will be using C# tuples with our library. Tuples allow you to combine the assignment of multiple variables of varying types in a single statement. For example, you can do this in a single line of code:

(string firstName, string lastName, int yearsOfExperience) = ("Fiqri", "Ismail", 15);

Let's have a look at using tuples in a .NET Standard 2.0 library.

Getting ready

Let's launch Visual Studio 2017 and make sure it's updated to the latest version. We will require C# 7.0 to complete this recipe.

How to do it...

  1. Open Visual Studio 2017.
  2. Click File | New | Project to create a project. 
  1. In the New Project dialog box, expand the Other Project Types node in the left-hand pane and select Visual Studio Solutions. In the right-hand pane, select Blank Solution.
  1. In the Name: textbox, type Chapter4.Tuples and, in the Location: textbox, select a path from the drop-down box or click on the Browse... button to locate a path:
  1. Click OK.
  2. Now, your...