.NET Standard 2.0 Cookbook
Develop high quality, fast and portable applications by leveraging the power of .NET Standard Library
Fiqri Ismail
BIRMINGHAM - MUMBAI
.NET Standard 2.0 Cookbook
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Richa Tripathi
Acquisition Editors: Denim Pinto/Nitin Dasan
Content Development Editor: Nikhil Borkar
Technical Editor: Jijo Maliyekal
Copy Editor: Safis Editing
Project Coordinator: Ulhas Kambali
Proofreader: Safis Editing
Indexer: Priyanka Dhadke
Graphics: Tania Dutta
Production Coordinator: Shraddha Falebhai
First published: May 2018
Production reference: 1090518
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78883-466-7
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Fiqri Ismail is an experienced architect with a demonstrated history of working in the information technology and services industry. Skilled in ASP.NET, ASP.NET MVC, ASP.NET Core, Entity Framework, C#, Microsoft Azure, PHP, and Delphi, he is a Microsoft MVP in Visual Studio and Related Technologies for 11 concussive years to date. He is also a community leader and a speaker at Sri Lanka Developer Forum and in Global Events such as Microsoft Tech Summit and Global Azure Bootcamp.
I would love thank Mr. Arjuna Seneviratna, my first teacher on web-related technologies and Mr. Saman Chandana Silva, who helped me buy my first computer. Also, I would like to thank my wife and daughter for giving their time to complete this book.
About the reviewer
Hansamali Gamage is an experienced professional and Microsoft MVP in Visual Studio and technologies from Sri Lanka. She possesses over 5 years of experience in. NET stack and Azure-related services. She is a frequent speaker at local and global tech events, a tech enthusiast, and an award winning writer on the Microsoft Tech Net forum. She works at TIQRI, previously known as Exilesoft, a technology-focused software engineering company with offices in Scandinavia, Asia, and Australia.
I would like to thank my loving family for their continuous help and support.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
This book is a step-by-step guide to building .NET Standard 2.0 Library and its usage in various .NET platforms. Also, we will demonstrate the usage of the library using ASP.NET, ASP.NET Core, ASP.NET MVC, Xamarin iOS, and Xamarin Android. Finally, we will guide you through how to package and send your library using the NuGet package manager.
Who this book is for
This book is for developers who need to get in touch with the new .NET Standard 2.0 Library. If you have a basic knowledge of C# and what a library can do to your code, that's enough to understand this book. Also, if you are a developer who writes third-party libraries, this will give you a fair idea of what .NET Standard 2.0 Library is and how you can cater to various .NET based platforms in Windows, Linux, and macOS using it.
What this book covers
, Back to Basics , g ives an overview of where it all began for the starters trying to build their first .NET based class library. It talks about the problems with this approach. Getting started with a simple project and using it with a console application and a classic Windows based application, the chapter talks about the issues with the current approach of libraries available. It introduces readers to .NET Standard 2.0 and its versions. How to create the first .NET Standard 2.0 library and use it with various .NET flavors such as .NET Framework and .NET Core applications is covered.
, Primitives, Collections, LINQ, and More , explor es the Core of .NET Standard 2.0. It talks about Primitives, Collections, Reflection, and LINQ. The areas supported so far are covered. It makes use of features among different flavors of .NET Framework.
, Working with Files, p rovides an explanation of System.IO and System.Security within the .NET Standard 2.0 and the usage of read write operations using the filesystem. Also, it introduces usage in cross-platform versions of .NET Core in Ubuntu and macOS.
, Functional Programming , i ntroduces functional programming capabilities in C# and how to use them in .NET Standard 2.0 Library.