Skip to content

Property EnableParameterSubstitution

Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll

EnableParameterSubstitution

Gets or sets a value indicating whether parameter values should be automatically substituted into the Python code using string interpolation.

csharp
public bool EnableParameterSubstitution { get; set; }

Property Value

bool

Examples

[Task]
[PythonCode("led = machine.Pin({pin}, machine.Pin.OUT); led.value({state})",
            EnableParameterSubstitution = true)]
Task SetLED(int pin, bool state);

// When called as: SetLED(2, true)
// Executes: led = machine.Pin(2, machine.Pin.OUT); led.value(True)

Remarks

When enabled, parameter placeholders in the Python code (e.g., {parameterName}) will be replaced with the actual parameter values passed to the method.

Parameter values are converted to Python-compatible representations:

  • Numbers are converted directly
  • Strings are properly quoted and escaped
  • Booleans are converted to Python True/False
  • Collections are converted to Python lists/dictionaries

Released under the Apache License 2.0.