DIVEX

The MakeInputIndirect operator

The MakeInputIndirect operator enables us to change the type of a parameter from X to Func<X>. Consider this example:

DelFunc.DF1 logMessage = (DateTime time, string message) =>
{
    Console.WriteLine(time + ": " + message);
};

var logMessage2 = logMessage
                        .MakeInputIndirect(time_getTime: 0);
DelFunc.DF1 is a Delegate Function. Delegate Functions is a way to support treating lambdas as functions.

In the example, logMessage has a parameter named time of type DateTime. Using the MakeInputIndirect operator, logMessage2 now has a parameter named getTime which is a function that takes nothing and returns DateTime:

When using MakeInputIndirect we specify the existing parameter name and the new parameter name using the syntax oldParameterName_newParameterName: 0. Zero here has no meaning and could be anything. It is just to satisfy the syntax of C#.