.NET Standard 2.0 Cookbook
eBook - ePub

.NET Standard 2.0 Cookbook

Develop high quality, fast and portable applications by leveraging the power of .NET Standard Library

Fiqri Ismail

Condividi libro
  1. 394 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

.NET Standard 2.0 Cookbook

Develop high quality, fast and portable applications by leveraging the power of .NET Standard Library

Fiqri Ismail

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Get the most out of.NET framework using standard libraries and create a.NET Standard 2.0 library from scratchAbout This Book• Write code once and share within.NET ecosystem in Windows, Linux and macOS• Give your.NET Libraries a common framework in cloud and on premise with the latest.NET Standard 2.0• Build a wide range of applications from Mobile with Xamarin to Web with ASP.NETWho This Book Is ForThis book is for.NET developers who are looking to build dynamic applications with the latest.NET Standard. C# knowledge is required.What You Will Learn• Create a.NET Standard 2.0 library• Use System.IO within the.NET Standard 2.0• Make use of your legacy.NET libraries with the new.NET Core standard• Explore the thread support to create a multithreaded.NET Standard 2.0 library• Create a.NET Standard 2.0 library and use it with an Android and iOS application• Implement various Visual Studio 2017 diagnostics and debugging tools• Create a NuGet Package and submit the package to the NuGet Package Manager • Use Visual Studio 2017 azure tools to deploy the application to Azure• Test and deliver a.NET Standard 2.0 libraryIn DetailThe.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.Style and approachA recipe-based approach to help you get the most out of the.NET Standard 2.0 Library that can be implemented to all the.NET Platforms

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
.NET Standard 2.0 Cookbook è disponibile online in formato PDF/ePub?
Sì, puoi accedere a .NET Standard 2.0 Cookbook di Fiqri Ismail in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Programming in C#. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781788838726
Edizione
1

Working with Files

In this chapter, we will be looking at these recipes:
  • Setting up .NET Core in Ubuntu
  • Creating a log as text
  • Creating an ASP.NET Core application in Ubuntu to use the library
  • Setting up .NET Core in macOS
  • Reading from a comma separated (CSV) text file
  • Creating a .NET Core console application in macOS to use the library
  • Compressing? Why not?
  • Creating a classic Windows application to use the library
  • Encrypting and Decrypting content in a text file
  • Creating a classic Windows application to use the library

Technical requirements

Readers should have a basic knowledge of C#. They should also have a basic knowledge of using Visual Studio, installing packages using NuGet, and referencing libraries within projects from other projects.
The code files for this chapter can be found on GitHub:
https://github.com/PacktPublishing/DotNET-Standard-2-Cookbook/tree/master/Chapter03
Check out the following video to see the code in action:
https://goo.gl/82FCEP

Introduction

As a developer, at some point, we will have to write some data to the disk or read data from the disk. This may be a simple text file, or may be a log file in a system you have written. .NET Framework offers great support for working with files. Mainly, we will be looking at the System.IO namespace and its usage of it.
In this chapter, we will be looking at some cross-platform applications as well. Each recipe will go through setting up new environments, such as Ubuntu and macOS, as well as building a .NET Standard 2.0 library and an accompanying application that uses the library.

Setting up .NET Core in Ubuntu

In this recipe, we will be going through how to set up .NET Core 2.x in an Ubuntu system. Ubuntu is a widely used Debian-based Linux environment. By visiting https://www.ubuntu.com/desktop, you can easily download and install Ubuntu on your system. You may have to use a virtual PC to do this. There are two great free tools that you can use:
  1. VMWare Workstation Player for Windows: https://www.vmware.com/products/workstation-player.html
  2. Oracle Virtual Box for Windows, Linux, and macOS: https://www.virtualbox.org/wiki/Downloads
This chapter assumes you have already set up and installed the required operating systems.

Getting ready

You will have to download a virtual PC and install the latest version of Ubuntu. If you haven't got a virtual PC that runs Ubuntu, make sure you have before continuing this recipe done it yet. I am using Ubuntu version 16.04 here. To find out which version you have, simply type the following command in the terminal:
$ lsb_release -a
You should get the following output:

How to do it...

  1. Open your favorite browser, type the following URL, and press Enter:
    https://www.microsoft.com/net/download/linux
  1. Select the Install .NET Core SDK 2.x Package button.
  1. From the Linux Distribution drop-down list, select Ubuntu 16.04.
  1. Follow the instructions on the page to install the current SDK or perform the following steps to install.
  2. Now open the terminal, type the following command, and press Enter:
 $ curl https://packages.microsoft.com/keys/microsoft.asc | 
gpg --dearmor > microsoft.gpg
  1. If you have a fresh installation of Ubuntu you might not have curl installed. If not use the following command to install curl:
 $ sudo apt-get install curl 
  1. Now, again in the terminal type the following command and press Enter to get the list of files:
 $ sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
  1. Type the following command and press Enter in the terminal:
 $ sudo sh -c 'echo "deb [arch=amd64] 
https://packages.microsoft.com/repos/
micro...

Indice dei contenuti