V
Vemund Halvorsen
Hello,
What is the best way of mapping a string to function/sub? See ex bellow -
probably not the best way - especially when it comes to maintenance
Does anybody have a better way of doing this?
Ex,
class A
Private mA as Integer
Public Sub SetFunc(byval func as string, byval value as integer)
Select Case value.ToUpper
Case "funcA".ToUpper
'do funcA
mA = value
Case "funcB".ToUpper
'do funcB
end select
end Sub
Public Function GetA() as Integer
return mA
end function
end class
class Test
Dim myA as new A
myA.SetFunc("funcA", 42)
Dim tmp as integer
tmp = myA.GetA()
end class
What is the best way of mapping a string to function/sub? See ex bellow -
probably not the best way - especially when it comes to maintenance
Does anybody have a better way of doing this?
Ex,
class A
Private mA as Integer
Public Sub SetFunc(byval func as string, byval value as integer)
Select Case value.ToUpper
Case "funcA".ToUpper
'do funcA
mA = value
Case "funcB".ToUpper
'do funcB
end select
end Sub
Public Function GetA() as Integer
return mA
end function
end class
class Test
Dim myA as new A
myA.SetFunc("funcA", 42)
Dim tmp as integer
tmp = myA.GetA()
end class