I am trying to understand for loop working in a special case, if someone can explain it will greatly help me.
Ok so what I am doing is downloading emails (like 50 at a time) from a mailbox say Hotmail (I am using MailBEE.NET objects for that) then upon download I am saving some things like sender name, attachments names (if any) in database and so on… It is a fairly long process considering the fact that the program first has to login on hotmail server then download the message and then run query to save stuff in db.
My question is if the function for doing all this work is defined in a separate assembly (dll file) and the calling program is a web based application which is using this assembly as reference, what will happen if I keep calling this function in for loop ? does the for loop wait for the function to finish ? or it will keep on calling this function multiple times ?
What better approach you suggest to do this work ?
Thanks.
It depends how you write the code that performs the downloading. If its just a method (albeit in a separate assembly), then your web interface will just new-up another instance and it will perform more than one loop download at a time.
You could consider using some sort of queue functionality, where you add a download request to a queue, and then have another worker/service using the queue to get its parameters, username/password/settings etc, on what to download.
I hope this helps, let me know if you need anything further.
Regards
Phil