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.
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.
- Open Visual Studio 2017.
- Click
File
|New
|Project
to create a project.
- In the
New Project
dialog box, expand theOther Project Types
node in the left-hand pane and selectVisual Studio Solutions
. In the right-hand pane, selectBlank Solution
.
- In the
Name:
textbox, typeChapter4.Tuples
and, in theLocation:
textbox, select a path from the drop-down box or click on theBrowse...
button to locate a path:
- Click
OK
. - Now, your...