.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

Partager le livre
  1. 394 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et 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

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que .NET Standard 2.0 Cookbook est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  .NET Standard 2.0 Cookbook par Fiqri Ismail en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Programming in C#. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2018
ISBN
9781788838726
Édition
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...

Table des matiĂšres