Hi! yes the AddEventObject and Scheduler.AddEventObjectThreadSafe methods are the only way to pass an argument !
But passing an argument is often not necessary, because you can of course create an object fore the method, and thus store as many parameters as you want !
for example :
Code:
class SomeClass
{
private string storedParameter1;
private int storedParameter2;
public SomeClass(string parameter1, int parameter2)
{
this.storedParameter1 = parameter1;
this.storedParameter2 = parameter2;
Scheduler.AddEventVoid(SomeFun);
}
private IEnumerable<ScheduleMethod> SomeFun()
{
Console.WriteLine(storedParameter1 + storedParameter2);
yield break;
}
}
There are lots and lots of different approaches to solve this ! Putting all arguments into a struct and then pass it as object parameter is most likely not the best one - because it is quite unsafe and involves casting !