Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

call a method from a variable name

Is it possible to call a method using a variable name?

varname="Function1"
varname()

varname = "Function2"
varname()
0
Delta7428
Asked:
Delta7428
1 Solution
 
crazymanCommented:
No it isnt, however using reflection you can.

eg

this.GetType().GetMethod("AMethodName").Invoke(this);

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now