call a method from a variable name

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

varname="Function1"
varname()

varname = "Function2"
varname()
Delta7428Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
crazymanConnect With a Mentor Commented:
No it isnt, however using reflection you can.

eg

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

0
All Courses

From novice to tech pro — start learning today.