I have a question about calling dynamicly created method names.
First of all: can this be done?
What I mean is the following:
We have a class Test with several (static) methods: ConvertA(), ConvertB(), ConvertC(), ConvertD(), ...
In our programm we get the letter of the method (eg A or B or C ...)
Then we want to concatenate "Test.Convert" with the letter (eg "A"
and the pharentesis and the call the method Test.ConvertA().
So our String concatenation will be like: "Test.Convert" + "A" + "()" (Maybe with 1 or more parameters).
Then the concatenated string is contaning the calling object and method name (with optional paramaters).
Then how to call the right class/method with that string?
If necessary only the method name can be concatenated.
We do not want to use a switch or if statement and then call the method.
Does anyone has an idea if it is possible and how to do it?
Thanks,
Madere.
First of all: can this be done?
What I mean is the following:
We have a class Test with several (static) methods: ConvertA(), ConvertB(), ConvertC(), ConvertD(), ...
In our programm we get the letter of the method (eg A or B or C ...)
Then we want to concatenate "Test.Convert" with the letter (eg "A"
So our String concatenation will be like: "Test.Convert" + "A" + "()" (Maybe with 1 or more parameters).
Then the concatenated string is contaning the calling object and method name (with optional paramaters).
Then how to call the right class/method with that string?
If necessary only the method name can be concatenated.
We do not want to use a switch or if statement and then call the method.
Does anyone has an idea if it is possible and how to do it?
Thanks,
Madere.