FunctionCallback Delegate

From DiceRoller Documentation

Encapsulates a method which executes function logic.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public delegate void FunctionCallback(
    FunctionContext context
)

Parameters

context
Type: Dice.FunctionContext
Function context, to be filled in by the delegate.

Remarks

The FunctionCallback delegate is used alongside the DiceFunctionAttribute and FunctionRegistry.RegisterType, or with FunctionRegistry.RegisterFunction. The delegate can gain insight into the context of the function call by examining the passed-in context object, and it must also modify the context object's Value. If no delegate in the chain modifies the context's Value, an InvalidOperationException is thrown.

The context's Values should also be modified, but if left null, then context.Expression.Values is used instead. Should that be null, an empty list is returned.