Implementation

Introduction

Object-oriented languages, including but not limited to CSharp, incorporate several features that contribute to functional programming. Let’s explore some of these constructs:

  • delegate and events - delegates are a fundamental construct in CSharp that enables late binding scenarios allowing the definition of a type-safe reference to a method; an event is essentially a delegate variable with additional restrictions,

  • extension methods - the extension method to use for static methods invocation syntax similar to the invocation of type members methods and finally cascading execution chain.

  • anonymous functions - allow definition and use of inline methods that don't have names,

This folder provides examples that can be applied to explain the above concepts.

Delegates and Events

The class DelegateExample provides a few examples of delegates and events. Check out the section Delegate and Events to get details. The UT located in the class DelegateExampleUnitTest contains test methods illustrating how to use the delegates and events.

Extension Methods

The class ExtensionMethods provides a few examples of extension methods. Check out the section Extension Methods to get details. The UT located in the class ExtensionMethodsUnitTest contain test methods illustrating how to use the extension methods and points out differences between usage the instance and extension methods against the instance methods.

Anonymous Functions

The class AnonymousFunctions provides a few examples of delegates and events. Check out the section Anonymous Functions to get details. The UT located in the class AnonymousFunctionsUnitTest contains test methods illustrating how to use the Anonymous Functions amd Expression Tree.

Last updated