C# Coding Solutions—Closure Functor

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Articles
C# Articles

C# Coding Solutions

© 2006 Christian Gross

The Closure Functor

The idea behind the closure functor is to be able to add an extra processing step when a specific logic is executed. For example, let’s say that for a collection it is necessary to assign a parent-child relationship. When an object is added to a collection, a closure functor would assign the parent to the child object. A closure functor could also be used to perform logging operations. The following is the definition of the closure delegate:

public delegate void DelegateClosure< type>( type input);

The delegate DelegateClosure<> uses Generics to define the input parameter, which represents the object to be manipulated. In the example of the running total, a closure functor would be used and not explained any further


Previous_Page_.gif Next_Page_.gif


Personal tools