From the course: Advanced C#: Functional Programming Patterns

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

The functional parts of C#

The functional parts of C#

C# and .NET, traditionally known for their object-oriented programming tools, have steadily embraced functional programming concepts. This is a tour of some of those features. Later in this course, we'll see how to include them in your applications. Just a note, I'll be using some functional programming terms like higher-order functions, which we'll dive into later. In functional programming, immutability is a core principle. Immutable data structures ensure that once an object is created, its state cannot be modified. In C#, read-only fields and properties, along with the immutable collections in System.Collections. Immutable allow you to create data structures that cannot be altered after they have been initialized. A function is considered a first-class function when it can be passed around as an argument, returned from another function, or assigned to a variable. C# supports first-class functions through delegates, lambda expressions, and the Func< T >, and Action< T > types…

Contents