What I would like to do is be able to take a Dictionary of key value pairs and make the key the name of a variable and the value the value.
From searching the net seems to be very vague on whether this is possible.
The equivalent in PHP would be:
foreach($array as $key=>$val)
{
$$key = $val;
}
Thanks.
You have to declare variables in .Net CLR languages (not to be confused with .Net dynamic runtime languages) at compile time. More than that, it’s generally better if you know the types of the variables as well. .Net programmers generally believe that this a good thing (the link is for C#, but the contents still apply).
What do you want to do with these variables? Tell us, and I’ll bet we can give you a better way to accomplish the same thing.