This is a contrived example, but lets say I have declared objects:
CustomObj fooObj;
CustomObj barObj;
CustomObj bazObj;
And I have an string array:
string[] stringarray = new string[] {"foo","bar","baz"};
How can I programatically access and instantiate those objects using the string array, iterating using something like a foreach:
foreach (string i in stringarray) {
`i`Obj = new CustomObj(i);
}
Hope the idea I'm trying to get across is clear. Is this possible in C#?
Thanks in advance.