paint-brush
Higher Order Functions in C#: A Practical Exampleby@samwalpole
816 reads
816 reads

Higher Order Functions in C#: A Practical Example

by Sam Walpole4mJuly 3rd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The repository pattern is a common design pattern used as a data access abstraction. It allows you to perform your typical CRUD operations without the client having to interact directly with the data provider. Using higher-order functions, we can define a single method that gets IEnumerable<Product> that takes a filter function as an input. That way, the client is free to define their own filters, and the ProductRepository doesn't need to keep being updated with new implementations. For example, the Map function takes a list of a particular data type and a function that returns a new list with the function applied to each of the elements.

Company Mentioned

Mention Thumbnail
featured image - Higher Order Functions in C#: A Practical Example
Sam Walpole HackerNoon profile picture
Sam Walpole

Sam Walpole

@samwalpole

Fullstack .NET and JavaScript web developer. Coding teacher and advocate

About @samwalpole
LEARN MORE ABOUT @SAMWALPOLE'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Sam Walpole HackerNoon profile picture
Sam Walpole@samwalpole
Fullstack .NET and JavaScript web developer. Coding teacher and advocate

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here