Lyfecycle Methods
Learn how to utilize the Init and Dispose lifecycle methods in your C# code actions
In addition to the Execute()
method, you can also implement the lifecycle methods outlined below.
All lifecycle methods are optional
Init()
The Init()
method is executed when your code is first compiled, including during Streamer.bot startup.
This is useful if you need to perform any initialization steps, such as setting up class-level variables or initializing objects that will later be used in your Execute()
method.
public void Init();
using System;
public class CPHInline
{
public bool Execute()
{
// your main code goes here
return true;
}
public void Init()
{
// place your init code here
}
}
Dispose()
The Dispose()
method is always executed on destroy, including during Streamer.bot shutdown.
This is useful when you need to perform some cleanup, such as disposing of objects or freeing up resources that were allocated during the lifetime of your code action.
public void Dispose();
using System;
public class CPHInline
{
public bool Execute()
{
// your main code goes here
return true;
}
public void Dispose()
{
// place your dispose code here
}
}