Skip to Content
.NET Standard 2.0 Cookbook
book

.NET Standard 2.0 Cookbook

by Fiqri Ismail
May 2018
Intermediate to advanced content levelIntermediate to advanced
394 pages
9h 51m
English
Packt Publishing
Content preview from .NET Standard 2.0 Cookbook

Introduction

This chapter talks about the functional programming capabilities of C# and how to use them for a .NET Standard 2.0 library. Let's look at a definition of functional programming: "Functional programming is a style that treats computation as the evaluation of mathematical functions and avoids changing state and mutable data."

Simply put, it means you will be able to use functions as inputs and outputs for other functions. You can also assign them to variables and store them in collections. Have a look at the following code, which explains what we just talked about:

Func<int, int> addNumbers = n => n + 1;var answer = addNumbers(1);answer // 2var range = Enumerable.Range(1, 5);var answers = range.Select(addNumbers);answers // 2, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 7 and .NET Core 2.0 High Performance

C# 7 and .NET Core 2.0 High Performance

Ovais Mehboob Ahmed Khan
.NET Core 2.0 By Example

.NET Core 2.0 By Example

Neha Shrivastava, Rishabh Verma

Publisher Resources

ISBN: 9781788834667Supplemental Content