I m not too clear, either. If you don t want to use reflection (heavy sometimes), for dynamically calling methods using a variable, you could use something like a collection containing delegates as values and call them.
I use an extremely like dictionary object to dynamically call a known method based on string inputs.
psuedo code:
delegate void Del(int i, double j);
class MathClass
{
static void Main()
{
MathClass m = new MathClass();
// Delegate instantiation using "MultiplyNumbers"
Del d = m.MultiplyNumbers;
Hashtable ht = new Hashtable();
ht.Add("mult", d);
// Invoke the delegate object.
System.Console.WriteLine("Invoking the delegate using MultiplyNumbers :");
for (int i = 1; i <= 5; i++)
{
((del) ht("mult"))(i, 2);
}
}
// Declare the associated method.
void MultiplyNumbers(int m, double n)
{
System.Console.Write(m * n + " ");
}
}