Higher Order Functions in C#: A Practical Exampleby@samwalpole
756 reads

Higher Order Functions in C#: A Practical Example

tldt arrow
Read on Terminal Reader🖨️

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

@samwalpole

Sam Walpole

About @samwalpole
LEARN MORE ABOUT @SAMWALPOLE'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa