Use a value as a variable name like CF evaluate function?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to .NET and was wondering if there is a function like the evaluate function in Cold Fusion that lets you use the value of something as a variable name instead of using a select case statement. For example:

Dim Line as String = "Action=Go"
Dim URLParts() As String = Line.Split("=")
Select Case URLParts(0).ToLower
Case "action"
us.CapabilityUrls.setAction(URLParts(1))

instead I want to be able to say something like
us.CapabilityUrls.set & evaluate(URLParts(0).ToLower) &(UrLParts(1))

In cold fusion you can do this by using an evaluate function. Any ideas?
 
Hi Rick,

I'm not quite clear on what you're after.

Eg, what is the text of this? And what is the outcome?
us.CapabilityUrls.set & evaluate(URLParts(0).ToLower) &(UrLParts(1))

Could you give a fuller example?

In the meantime, take a look at CallByName. If that's insufficient, then
you'll be looking to Reflection .

Regards,
Fergus
 
Dim Line as String = "Action=Go"

I want
us.CapabilityUrls.set & evaluate(URLParts(0).ToLower) &(UrLParts(1))

to evaluate to:
us.CapabilityUrls.setAction(URLParts(1))

does that make sense?

----- Fergus Cooney wrote: -----

Hi Rick,

I'm not quite clear on what you're after.

Eg, what is the text of this? And what is the outcome?
us.CapabilityUrls.set & evaluate(URLParts(0).ToLower) &(UrLParts(1))

Could you give a fuller example?

In the meantime, take a look at CallByName. If that's insufficient, then
you'll be looking to Reflection .

Regards,
Fergus
 
Back
Top