.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

Buch teilen
  1. 394 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

.NET Standard 2.0 Cookbook

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

Fiqri Ismail

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist .NET Standard 2.0 Cookbook als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu .NET Standard 2.0 Cookbook von Fiqri Ismail im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Programming in C#. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2018
ISBN
9781788838726

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...

Inhaltsverzeichnis