How to pass the set in container from one class to another?

I’ve got MyClass1 (RunBaseBatch) and MyClass2 (RunBase). In the MyClass2 run() method there is a created set which is populated with selected by user records from a form. Next I need this set to be packed to the container and to be passed to the run() method of MyClass1.

Please kindly advise or share an example of passing the packed set between classes.

Why do you want to use a Set object packed to a container instead of simply passing the Set object itself?
Packing and unpacking would be done automatically if you used the newer framework (SysOperation), but if you insist on using RunBaseBatch, you must implement pack() and unpack() methods by yourself (in pack(), use Set.pack() to serialize the set, and then deserialize it in unpack with Set::create()). When the batch gets triggered, the framework will call unpack() and when run() is executed, parameters are already unpacked. Therefore if you want to send the Set to another class, you can simply pass a reference - there is no need to pack it again.

thank you! that worked for me