Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class WorkerBase<S, I, O> {
- public WorkerBase() { }
- public virtual bool Initialize() {
- return true;
- }
- public abstract List<O> Process(S settings, List<I> input);
- }
- static ObjectPool<MyPool, MyPool.Settings, MyPool.Input, MyPool.Output> myPool = new ObjectPool<MyPool, MyPool.Settings, MyPool.Input, MyPool.Output>();
- // Later...
- var output = myPool.Process(settings, input);
- public class ObjectPool<T, S, I, O> where T : WorkerBase<S, I, O>, new() {
- /* Much implementation omitted for sake of clarity */
- public List<O> Process(S settings, List<I> input) {
- // Indirectly calls worker's Process function
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement