R
Roy Gourgi
Hi,
My program has to be able to call on many classes that differ only by a
number and rather than use a switch statement I was wandering if it is
possible to do it in C# as it is possible in other languages. For example,
if I want to call any one of 100 different classes named clsNo1,
clsNo2,clsNo3, ..... clsNo100 from my calling program I can use the switch
statement but it is obviously quite cumbersome. Is it possible instead of
doing something like this:
class Program
{
static void Main(string[] args)
{
string lcStr="clsNo";
lcStr+="5"; // This is to be able to call the class clsNo5
// and then I would like to be able to execute this
statement, so that it would be the equivalent of calling //
the class clsNo5();
}
}
TIA
Roy
My program has to be able to call on many classes that differ only by a
number and rather than use a switch statement I was wandering if it is
possible to do it in C# as it is possible in other languages. For example,
if I want to call any one of 100 different classes named clsNo1,
clsNo2,clsNo3, ..... clsNo100 from my calling program I can use the switch
statement but it is obviously quite cumbersome. Is it possible instead of
doing something like this:
class Program
{
static void Main(string[] args)
{
string lcStr="clsNo";
lcStr+="5"; // This is to be able to call the class clsNo5
// and then I would like to be able to execute this
statement, so that it would be the equivalent of calling //
the class clsNo5();
}
}
TIA
Roy