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

Reading from a comma separated (CSV) text file


In this recipe, will be using .NET Core 2.0 under macOS. I assume you are familiar with using a terminal and typing a few commands in it. We will be looking at command-line tools supplied with .NET Core 2.0 to create our .NET Standard 2.0 library that reads a Comma Separated Values (CSV) file and returns its data.

Getting ready

If you have not already completed the previous recipe, make sure you have done it. It will help you to download .NET Core 2.0 and Visual Studio Code as an IDE. Let's fire up the terminal and get started.

How to do it...

  1. Open a terminal window (Applications | Utilities | Terminal).
  2. Now, in your home directory, type the following command (you might have to create a separate directory for your projects and do the following command): 
$ dotnet new sln -o Chapter3.CsvFile
  1.  Now, type the following command to navigate to the newly created solution:
$ cd Chapter3.CsvFile
  1. Again, type this command to create the .NET Standard 2.0 library...