Property Order
Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll
Order
Gets or sets the order in which this teardown method should be executed relative to other teardown methods in the same class.
csharp
public int Order { get; set; }
Property Value
Examples
public class SensorArray : Device
{
[Teardown(Order = 1)]
private async Task StopCollectionAsync()
{
// Stop data collection first
await ExecuteAsync("stop_all_sensors()");
}
[Teardown(Order = 2)]
private async Task SaveDataAsync()
{
// Save collected data second
await ExecuteAsync("save_buffered_data()");
}
[Teardown(Order = 3)]
private async Task PowerDownAsync()
{
// Power down hardware last
await ExecuteAsync("power_down_sensors()");
}
}
Remarks
Use the Order property when you have multiple teardown methods that must execute in a specific sequence. Typically, you want to stop background operations before saving data, and save data before releasing hardware.
Teardown methods in derived classes always execute before those in base classes, regardless of order values.