MacroRegistry.RegisterMacro Method (String, MacroCallback)

From DiceRoller Documentation

Registers the specified callback to the given name.

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

Syntax

public void RegisterMacro(
    string name,
    MacroCallback callback
)

Parameters

name
Type: System.String
Macro name to register. Macro names are case-insensitive.
callback
Type: Dice.MacroCallback
The method to be called whenever the macro is called in a dice expression.

Exceptions

Exception Condition
ArgumentNullException name is null.
ArgumentException name is the empty string.
InvalidOperationException A macro with the same name has already been registered.

Remarks

This registers a new macro with the given name.

There can only be one callback associated with any given macro name. It is an error to re-register a macro, but a macro can be removed and then registered again.