What is the most efficient way to run a C# script with external variables?

  Uncategorised

I have done quite a bit of search but still I am not sure whether this question has been asked before. It may be due to the fact that I am not proficient to C# so if there is, please point me towards the right direction!

I have a C# script which makes API calls and stores the responses into SQL tables.
I would like the program to be called many times in parallel, each time for different credentials (Client Token, Access Token) in regular schedule.
Let’s say that I have 6 different sets of credentials (therefore the program needs to be ran 6 times in parallel now, 6 times in parallel half an hour later, etc).

I would not want to have 6 identical versions of the script, each version with a specific set of credentials hardcoded because doing changes in such a script is pain as you can imagine.

I figured out I can have a text file which will contain all the credentials and the script will be looping through it. But still, this will be a sequential process rather than parallel.

Is there any other way I could schedule a script to run 6 times in parallel by passing different variables in it?

Source: Visual Studio Questions

LEAVE A COMMENT