I have a program with a timer that checks a folder with xml files. This folder my contain 3 type of files. I want to work with threads to process each type file with its own thread. The method processing the files has one folderitem parameter. Could you help me on the way with a proper example?
Its not that I don’t understand threads. I already used them with a web application using a process button.
My current application runs as a service in a windows environment and the initial method receives a folderitem.
I’m not able to find an example that triggers a method using threads with multiple parameters.
A simple workaround would be to use a module with properties. Set the properties from the main thread, and your processing thread can access those properties just fine.
Either a constructor or a Run method will work.
I’d make a private zero param constructor and one with parameters.
I’d prefer a constructor since you could mistakenly call the Run method with no parameters and it might not be obvious why things don’t work as expected.